[R] persp() problem

From: Michael Sun <mam3xs_at_gmail.com>
Date: Wed 13 Dec 2006 - 11:19:27 GMT


Dear list,

I have a problem on persp()

x <- u1data #first coloum in attached data
y <- u2data #second coloum in attached data
f <- function(x,y){qgev(pnorm(rhoF*qnorm(pnorm((qnorm(y)-rho2*qnorm(x)/sqrt(1-rho2^2))))
                   +sqrt(1-rhoF^2)*qnorm(0.95)),-0.3935119, 0.4227890,
 0.2701648)}
z <- outer(x,y,f)
persp(x,y,z)

The R will display:
"Error in persp.default(x, y, z) : increasing 'x' and 'y' values expected"

So I try to adjust it to:

testx <- unique(sort(u1data))
testy <- unique(u2data[order(u1data)])
testf <- function(testx,testy){qgev(pnorm(rhoF*qnorm(pnorm((qnorm(testy)-rho2*qnorm(testx)/sqrt(1-rho2^2))))

+sqrt(1-rhoF^2)*qnorm(0.95)),-0.3935119, 0.4227890, 0.2701648)} testz <- unique(outer(testx,testy,testf)[order(u1data)])

BUT SAME WARN: "Error in persp.default(testx, testy, testz) :

        increasing 'x' and 'y' values expected "

So how can I use persp in this situation?????? Thanks for any help!



Besides that I also want to enquiry on how to build the martix below?

    [,1] [,2] [,3] [,4] [,5].......[,676]
[1,] 1 NA NA NA NA
[2,] NA 5 NA NA NA
[3,] NA NA 7 NA NA
[4,] NA NA NA 9 NA
[5,] NA NA NA NA 12

  .    .
  .    .
  .

[676,]

Appreciate for any reply.

Thank you,

With regards
Mc



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Received on Thu Dec 14 10:56:56 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 14 Dec 2006 - 01:30:55 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.