MultiNormal | R Documentation |
Density and random sampling for the Multivariate Normal distribution.
dmNorm(x, mu, Sigma, log = FALSE) rmNorm(n, mu, Sigma)
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. |
A vector for densities, or a n x q
matrix for random sampling.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.