On Aug 23, 2010, at 11:05 PM, rusers.sh wrote:

Hi,
If you see the link http://www.stata.com/help.cgi?drawnorm, and you can
see an example,
#draw a sample of 1000 observations from a bivariate standard
normal distribution, with correlation 0.5.
#drawnorm x y, n(1000) corr(0.5)
This is what Stata software did. What i hope to do in R should be similar
as that.
It will be better to only need us to specify the correlation matrix, mean values and possible variances. One of my aim is to simulate random fields.
 Thanks.

?cov2cor

--
David.


2010/8/23 Ben Bolker <bbol...@gmail.com>

rusers.sh <rusers.sh <at> gmail.com> writes:

rmvnorm()can be used to generate the random numbers from a multivariate normal distribution with specified means and covariance matrix, but i
want
to specify the correlation matrix instead of covariance matrix for the
multivariate
normal distribution.
Does anybody know how to generate the random numbers from a multivariate
normal distribution with specified correlation matrix? What about
other non-normal
distribution?

What do you want the variances to be? If you don't mind that they're all equal to 1, then using your correlation matrix as the Sigma argument to the mvrnorm() [sic] function in MASS should work fine. They have to
be defined as *something* ....
If you want multivariate distributions with non-normal marginal
distributions, consider the 'copula' package, but be prepared to do
some reading -- this is a fairly big/deep topic.

good luck.



David Winsemius, MD
West Hartford, CT

______________________________________________
R-help@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.

Reply via email to