View source: R/mcmc_functions.R
mvnorm_chol | R Documentation |
This draws a sample from a multivariate normal distribution with mean vector mu and covariance matrix Sigma. It requires the covariance matrix to be decomposed using the Cholesky method (chol).
mvnorm_chol(mu, chol)
mu |
The mean vector |
chol |
The cholesky decomposition of the covariance matrix Sigma |
a vector containing a sample from the distribution
mu <- c(2, 1) #mean vector sigma <- matrix(c(2^2, 0.5*2*1, 0.5*2*1, 1^2), 2, 2) #covariacne matrix sigma.chol <- chol(sigma) #decompose covariance matrix #f <- mvnorm_chol(mu, sigma.chol) #draw sample
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.