Re: [S] generate multivariate normal data

Georges Monette (georges@pascal.math.yorku.ca)
Thu, 12 Feb 1998 22:49:55 -0500


Here's how to create a matrix whose rows are independent
multivariate normal vectors with mean 0 and variance matrix SIG:

> mat <- matrix(rnorm(n*p),ncol=p) %*% chol(SIG)

where n is the number of observations and SIG is p x p.

If you want a mean of MU:

> mat <- t(t(mat) + MU)

Best regards,
Georges Monette

>
> Do anybody know how to generate multivariate normal data from the
> correlation matrix?
> Is there any standard Splus program can do it?
> Thank you for any comment.
>
> David Wang
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news