rmunorm {mcsm} | R Documentation |
This function produces one random vector distributed from the multivariate normal distribution N(mu,sig).
rmunorm(mu, sig)
mu |
Mean mu of the normal distribution |
sig |
Covariance matrix sig of the normal distribution |
This function returns a real vector of the same dimension as mu.
Similar to dmunorm
,
this function is fragile in that it does not test for
sig
is a square matrix,
x
, mu
, sig
sig
It is therefore prone to fail if those conditions are not satified! If the package
bayesm
can be installed, rmvnorm
is to be prefered to rmunorm
.
Christian P. Robert and George Casella
Chapter 8 of EnteR Monte Carlo Statistical Methods
rnorm,dmunorm,rmvnorm(bayesm)
test=NULL for (t in 1:10^4) test=rbind(test,rmunorm(rep(1,2),matrix(c(1,-2,-2,10),ncol=2))) cor(test[,1],test[,2])*sqrt(10) # should be close to -2