[R] How to plot countours with fixted densities?

Eik Vettorazzi E.Vettorazzi at uke.uni-hamburg.de
Sat Oct 4 16:42:00 CEST 2008


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 at 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 at 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.



More information about the R-help mailing list