[R] from a normal bivariate distribution to the marginal one
Elisabetta Petracci
elisabetta.petracci at unimi.it
Wed Jan 23 13:18:50 CET 2008
Hello,
I'm quite new with R and so I would like to know if there is a command
to calculate an integral.
In particular I simulated a bivariate normal distribution using these
simple lines:
rbivnorm <- function(n, # sample size
mux, # expected value of x
muy, # expected value of Y
sigmax, # standard deviation of X
sigmay, # standard deviation of Y
rho){ # correlation coefficient
x <- rnorm(n,mux,sigmax)
y <- rnorm(n,muy+rho*sigmay*(x-mux)/sigmax, sigmay*sqrt(1-rho2))
cbind(x,y)
}
In this way I've sampled from a normal bivariate distribution and I've
obtained two vectors of values:x and y..
Now, I would like to find the marginal distribution of y from the
bivariate distribution.
Is there a command to do this?
Thank you,
Elisabetta
More information about the R-help
mailing list