rmultnorm: Multivariate Normal Random Number Generator

Description Usage Arguments Details Value Note Author(s) See Also Examples

Description

Generates multivariate normal random variates for give mean and covariance vectors. Can also handle generation of multivariate normal deviates with singular covariance distributions via singular value decomposition (SVD).

Usage

1
rmultnorm(n, mu, vmat, tol = 1e-10)

Arguments

n

Number of variates to draw.

mu

m column matrix of multivariate means

vmat

m xm covariance matrix

tol

Tolerance level used for SVD of the covariance. Default is 1e-10

Details

Generates n draws from a multivariate normal distribution with mean matrix mu and covariance matrix vmat.

Value

Matrix of the random draw that is conformable with the input mu.

Note

Based on code by Jeff Gill. This function is called in the hard condition forecasting in hc.forecast for simulating the structural innovations.

Author(s)

Patrick T. Brandt

See Also

rnorm

Examples

1
rmultnorm(1, matrix(c(1,2),2,1), vmat=matrix(c(1,1,0,1),2,2))

Example output

##
## MSBVAR Package v.0.9-2
## Build date:  Fri Jun 16 08:52:34 2017 
## Copyright (C) 2005-2017, Patrick T. Brandt
## Written by Patrick T. Brandt
##
## Support provided by the U.S. National Science Foundation
## (Grants SES-0351179, SES-0351205, SES-0540816, and SES-0921051)
##

          [,1]     [,2]
[1,] 0.3686478 1.760405

MSBVAR documentation built on May 30, 2017, 1:23 a.m.

Related to rmultnorm in MSBVAR...