MultiNormal {mniw} | R Documentation |
The Multivariate Normal distribution.
Description
Density and random sampling for the Multivariate Normal distribution.
Usage
dmNorm(x, mu, Sigma, log = FALSE)
rmNorm(n, mu, Sigma)
Arguments
x |
Argument to the density function. A vector of length |
mu |
Mean vector(s). Either a vector of length |
Sigma |
Covariance matrix or matrices. Either a |
log |
Logical; whether or not to compute the log-density. |
n |
Integer number of random samples to generate. |
Value
A vector for densities, or a n x q
matrix for random sampling.
Examples
# Parameter specification
q <- 4 # number of dimensions
mu <- 1:q # mean vector
V <- toeplitz(exp(-seq(1:q))) # variance matrix
# Random sample
n <- 100
X <- rmNorm(n, mu, V)
# Calculate log density for each sampled vector
dmNorm(X, mu, V, log = TRUE)
[Package mniw version 1.0.1 Index]