[R] plot smooth density estimates for bivariate data

Romain Francois francoisromain at free.fr
Sun Feb 6 10:37:20 CET 2005


Hello,

try to look at those pages :

library(MASS)
?kde2d
?contour
?image
?persp


x11(height=6,width=12)
par(mfrow=c(1,2))
X <- rnorm(200)
Y <- rnorm(200)
d <- kde2d(X,Y)
persp(d,phi=30,theta=30)

image(d,col=terrain.colors(25))
contour(d,add=T)



Romain.

Le 05.02.2005 23:51, Yulei He a écrit :

>Hi, there.
>
>Suppose I have a bivarariate data matrix y1 and y2. I want to plot a 3-D
>picture of the estimated density f(y1, y2) against y1 and y2? How can I do
>that? Do I use persp() or density()?
>
>  
>
density is for 1d estimation of density.

>Thanks for your help.
>
>Yulei
>
>
>$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
>Yulei He
>1586 Murfin Ave. Apt 37
>Ann Arbor, MI 48105-3135
>yuleih at umich.edu
>734-647-0305(H)
>734-763-0421(O)
>734-763-0427(O)
>734-764-8263(fax)
>$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
>
>  
>

-- 
Romain FRANCOIS : francoisromain at free.fr
page web : http://addictedtor.free.fr/  (en construction)
06 18 39 14 69 / 01 46 80 65 60
_______________________________________________________
Etudiant en 3eme année
Institut de Statistique de l'Université de Paris (ISUP)
Filière Industrie et Services
http://www.isup.cicrp.jussieu.fr/




More information about the R-help mailing list