rmvnorm {lazy.stat} | R Documentation |
Multivariate Normal Random Numbers
rmvnorm(n, mu, Sigma)
n |
# of random numbers to be generated |
mu |
The mean vector |
Sigma |
The Variance-Covariane Matrix (Dispersion Matrix) |
When Sigma is not full rank, degenerated random numbers will be returned.
set.seed=(1701) n=1000 # nonsingular Sigma mu=c(10,20); Sigma=matrix(c(5,2,2,2),2,2) X=rmvnorm(n,mu,Sigma) md=mandd(X) # singular Sigma mu=c(10,20); Sigma=matrix(c(2,2,2,2),2,2) X=rmvnorm(n,mu,Sigma) md=mandd(X)