multi_rnorm | R Documentation |
Generate random numbers from a multivariate normal distribution. It can be used to create correlated random numbers.
multi_rnorm(n, mean, sd)
n |
The number of samples desired for each variable. |
mean |
A vector giving the mean of each variable. |
sd |
A valid covariance matrix. |
A matrix with n rows and as many columns as mean values.
mus <- c(0, 3, 5)
sigmas <- matrix(c(1, 0.265, 2.19, 0.265, 0.25, 0.66, 2.19, 0.66, 9), ncol = 3)
mat <- multi_rnorm(100, mus, sigmas)
var(mat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.