You can use a few functions:  persp, contour, filled.contour, image.  Say
dens() is your density function of two variables, for example,

dens <- function(x, y) { dnorm(x) * dnorm(y) }

then you could do:

x <- seq(-3, 3, len = 40)
y <- seq(-3, 3, len = 30)
g <- expand.grid(x, y)
mat <- matrix(dens(g[,1], g[,2]), nrow = 40, ncol = 30)
image(x,y,mat)
persp(x,y,mat)
filled.contour(x,y,mat)
contour(x,y,mat)


-roger
_______________________________
UCLA Department of Statistics
[EMAIL PROTECTED]
http://www.stat.ucla.edu/~rpeng

On Sat, 11 Jan 2003, H. Zmarrou wrote:

> 
> Dear R-ers:
> I'm sorry to disturb you, I want just ask if R can plot a given  
> complicated density function. I mean if we have the expression of the 
> density en we want to see how it's look like? and this is a density 
> with two variables thus it's a 3D plot  
> 
> Thank you very much
> Hicham Amsterdam
> 
> ______________________________________________
> [EMAIL PROTECTED] mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help
>

______________________________________________
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to