mvnorm_chol: Draw a sample from a multivariate normal diastirbution

Description Usage Arguments Value Examples

View source: R/mcmc_functions.R

Description

This draws a sample from a multivariate normal distribution with mean vector mu and covariance matirx Sigma, using the Cholesky decomposition method.

Usage

1

Arguments

mu

The mean vector

chol

The cholesky decomposition of the covariance matrix Sigma

Value

a vector containing a sample from the distribution

Examples

1
2
3
4
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

jasa-btun-anon/BTUN documentation built on Sept. 12, 2020, 12:54 a.m.