Thanks a lot! It works, however it is less smooth than I had expected.
 
And I have a further question: 
What if I have my own 2-d density function as: 
f <- function(x1,x2,parameters) 
...
 
and there is no way how to generate random variates (x1,x2) from f. But I'd 
still like to get the contour densities plots for (x1,x2) at levels 10^(-j/2) 
for j=2,...,9. Is there a method to do that? A smooth plot would be even more 
useful in my case.  
 
LX


ÔÚ2008-10-04 22:42:00£¬"Eik Vettorazzi" <[EMAIL PROTECTED]> дµÀ£º
>Sorry, mixed up where to place the desired level, it has to be done in 
>the plot part, as in
>
>d <- kde2d(z1,z2)
>contour(d, levels=10^(-(2:9)/2), add=T)
>
>
>Eik Vettorazzi schrieb:
>> You may use kde2d from MASS, with estimates a 2d density
>>
>> d <- kde2d(z1,z2,h=10^(-(2:9)/2))
>> plot(z1,z2)
>> contour(d,add=T)
>>
>> hth.
>>
>> biyeshejiqx schrieb:
>>> Hello,everybody,
>>>  
>>> I used the following codes to generate bivariate normal dependence 
>>> structure with unit Frechet margins.      Sigma <- 
>>> matrix(c(1,.5*sqrt(1),.5*sqrt(1),1),2,2) # generate   y <- 
>>> mvrnorm(Nsam, c(0,0), Sigma) # random   v <- cbind(pnorm(y[,1],mean = 
>>> 0, sd = 1), pnorm(y[,2],mean = 0, sd = 1))
>>>   z <- cbind(-1/log(v[,1]),-1/log(v[,2]))
>>>   z1 <- z[,1]
>>>   z2 <- z[,2]
>>> And to get the scatter plot by:   plot(z1,z2)
>>>  
>>> How can I get the contour densities plots for (z1,z2) at 10^(-j/2) 
>>> for j=2,...,9?
>>>  
>>> Waiting for your reply!Many thanks!
>>>  
>>> Xiao  
>>>  
>>>  
>>>     [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> R-help@r-project.org 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.
>>>
>>
>> ______________________________________________
>> R-help@r-project.org 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.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to