[R] Plot bivariate joint pdf

Ben Bolker bolker at ufl.edu
Mon May 11 15:46:03 CEST 2009




beetle2 wrote:
> 
> For a homework question.
> I was wondering if rcmdr has a function to plot a graph of a bivariate
> function of X and Y.
> I have a function with joint pdf
> 
> fX,Y(x,y) = x+y for 0<x<1  , 0<y<1
> 
> I've tried
>> x <- seq(0,1,.001) 
>> y <- seq(0,1,.001) 
>> r = x+y
>> plot(r)
> 
> but it seems to just add them together say .2+.2 .3+.3  not other
> possibilities like
> 
> .9 + .1
> 
> 

We don't do homework questions here, but a few hints:

(1) the question doesn't seem to be fully specified.  Are x and y supposed
to be uniform?

(2) you could get a reasonable representation of the solution (although
not necessarily one your prof would be happy with) by adding
runif(10000,0,1) and runif(10000,0,1)

(3) to do this analytically, think about convolutions and/or moment
generating
functions.

  Ben Bolker

-- 
View this message in context: http://www.nabble.com/Plot-bivariate-joint-pdf-tp23481872p23483615.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list