Multivariate Normal Density and Random Deviates
These functions provide the density function and a random number
generator for the multivariate normal
distribution with mean equal to mean
and covariance matrix
sigma
.
dmvnorm(x, mean = rep(0, p), sigma = diag(p), log = FALSE, checkSymmetry = TRUE) rmvnorm(n, mean = rep(0, nrow(sigma)), sigma = diag(length(mean)), method=c("eigen", "svd", "chol"), pre0.9_9994 = FALSE, checkSymmetry = TRUE)
x |
vector or matrix of quantiles. If |
n |
number of observations. |
mean |
mean vector, default is |
sigma |
covariance matrix, default is |
log |
logical; if |
method |
string specifying the matrix decomposition used to
determine the matrix root of |
pre0.9_9994 |
logical; if |
checkSymmetry |
logical; if |
Friedrich Leisch and Fabian Scheipl
dmvnorm(x=c(0,0)) dmvnorm(x=c(0,0), mean=c(1,1)) sigma <- matrix(c(4,2,2,3), ncol=2) x <- rmvnorm(n=500, mean=c(1,2), sigma=sigma) colMeans(x) var(x) x <- rmvnorm(n=500, mean=c(1,2), sigma=sigma, method="chol") colMeans(x) var(x) plot(x)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.