rmvnorm: Generating from multivariate normal distribution with...

rmvnormR Documentation

Generating from multivariate normal distribution with location vector \bold{\mu} and covariance matrix \Sigma_{d \times d}.

Description

Using the well-recognized Cholesky decomposition, this function simulates from the density function of a d-dimensional random vector \bold{Y}=(Y_1,\cdots,Y_d)^{T} following a normal distribution with mean vector \bold{\mu} and covariance matrix \Sigma_{d \times d} is

f_{\bold{Y}}(\bold{y})=\frac{1}{(2 \pi)^{\frac{d}{2}}\vert \Sigma\vert ^{-\frac{1}{2} } } \exp\biggl\{-\frac{(\bold{y}-\bold{\mu})^t\Sigma^{-1}(\bold{y}-\bold{\mu})}{2}\bigg\},

Usage

rmvnorm(n, Mu, Sigma) 

Arguments

n

number of realizations.

Mu

location vector.

Sigma

covariance (dispersion) matrix.

Value

an n \times d matrix of realizations from multivariate normal distribution with mean vector \bold{\mu} and covariance matrix \Sigma_{d \times d}.

Author(s)

Mahdi Teimouri

Examples


      n <- 100
    Mu  <- rep(0, 2)
 Sigma  <- matrix( c( 2, 0.50, 0.50, 2 ), nrow = 2, ncol = 2 )
 rmvnorm(n, Mu, Sigma)


ForestFit documentation built on April 3, 2025, 5:27 p.m.

Related to rmvnorm in ForestFit...