rmvnorm: Draw from multivariate normal distribution

View source: R/RcppExports.R

rmvnormR Documentation

Draw from multivariate normal distribution

Description

This function draws from a multivariate normal distribution.

Usage

rmvnorm(mu, Sigma)

Arguments

mu

The mean vector of length n.

Sigma

The covariance matrix of dimension n x n.

Details

The function builds upon the following fact: If ε = (ε_1,…,ε_n), where each ε_i is drawn independently from a standard normal distribution, then μ+Lε is a draw from the multivariate normal distribution N(μ,Σ), where L is the lower triangular factor of the Choleski decomposition of Σ.

Value

A numeric vector of length n.

Examples

mu <- c(0,0)
Sigma <- diag(2)
rmvnorm(mu = mu, Sigma = Sigma)

RprobitB documentation built on Nov. 10, 2022, 5:12 p.m.