View source: R/random_values_simulation.R
| Multivariate normal and t random values simulation | R Documentation | 
Multivariate normal and t random values simulation.
rmvnorm(n, mu, sigma, seed = NULL)
rmvt(n, mu, sigma, v, seed = NULL)
| n | The sample size, a numerical value. | 
| mu | The mean vector in  | 
| sigma | The covariance matrix in  | 
| v | The degrees of freedom. | 
| seed | If you want the same to be generated again use a seed for the generator, an integer number. | 
The algorithm uses univariate normal random values and transforms them to multivariate via a spectral decomposition. It is faster than the command "mvrnorm" available from MASS, and it allows for singular covariance matrices.
A matrix with the simulated data.
Michail Tsagris
R implementation and documentation: Michail Tsagris <mtsagris@uoc.gr>
Aitchison J. (1986). The statistical analysis of compositional data. Chapman & Hall.
racg, rmvlaplace, rmvt
x <- as.matrix(iris[, 1:4])
m <- colmeans(x)
s <- cov(x)
y <- rmvnorm(1000, m, s)
res<-colmeans(y)
res<-cov(y)
y <- NULL
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.