Description Usage Arguments Details Value Author(s) Examples
Draw vectors from a multivariate normal distribution.
1 | rmvtnorm (n = 1, k = 2, means = rep (0, k), sigma = diag (k))
|
n |
The number of vectors to be drawn. |
k |
The dimension of the vectors to be drawn. |
means |
A vector of means, one for each dimension. |
sigma |
The covariance matrix of the distribution. If a number between 0 and 1 is provided, this is assumed to be the correlation parameter for a bivariate standard normal distribution. |
If means and sigma are not specified, a standard normal distribution is assumed along every dimensions, and dimensions are assumed to be uncorrelated. If the number of dimensions is not specified, a bivariate distribution is assumed.
A matrix with rows equal to n and columns equal to k, where each row indicates a single observation, and each column represents a different dimension.
Santiago Barreda <sbarreda@ucdavis.edu>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## Examples of draws from different bivariate normal distributions
## and standard deviation ellipses drawn to fit them.
par (mfrow = c(2,2))
draws = rmvtnorm (n = 1000, k = 2, sigma = .3)
plot (draws)
sdellipse (draws, stdev = 3, lwd = 3, col = 2)
draws = rmvtnorm (n = 1000, k = 2, sigma = -.3)
plot (draws)
sdellipse (draws, stdev = 3, lwd = 3, col = 2)
draws = rmvtnorm (n = 1000, k = 2, sigma = -.7)
plot (draws)
sdellipse (draws, stdev = 3, lwd = 3, col = 2)
draws = rmvtnorm (n = 1000, k = 2, sigma = .7)
plot (draws)
sdellipse (draws, stdev = 3, lwd = 3, col = 2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.