[R] How to plot contours for joint density of 2 independently distributed r.v.?
rlearner309
unixunix99 at gmail.com
Mon Sep 15 17:10:33 CEST 2008
Wonderful!
THanks a lot!!
Dimitris Rizopoulos-4 wrote:
>
> do you know the probability density functions for these random variable?
> If yes, then you need something like the following:
>
> x <- seq(-5, 5, len = 50)
> y <- seq(0.001, 10, len = 50)
> z <- outer(x, y, function(x, y){
> dnorm(x) * dgamma(y, 5)
> })
>
> contour(x, y, z)
>
> where you replace dnorm() and dgamma() with your pdf's.
>
> If you just have a sample from X and Y, then you could use kernel
> density estimation, for instance, check
>
> help("bkde2D", package = "KernSmooth")
>
>
> I hope it helps.
>
> Best,
> Dimitris
>
>
> rlearner309 wrote:
>> X and Y are independently distributed random variables.
>> I would like to study the contours of the joint density of these two
>> variables.
>> Any function to call?
>>
>> Thank you very much!
>
> --
> Dimitris Rizopoulos
> Assistant Professor
> Department of Biostatistics
> Erasmus University Medical Center
>
> Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
> Tel: +31/(0)10/7043478
> Fax: +31/(0)10/7043014
>
> ______________________________________________
> 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.
>
>
--
View this message in context: http://www.nabble.com/How-to-plot-contours-for-joint-density-of-2-independently-distributed-r.v.--tp19493126p19494972.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list