spam (version 2.5-1)

rmvnorm.const: Draw Constrainted Multivariate Normals

Description

Fast ways to draw multivariate normals with linear constrains when the variance or precision matrix is sparse.

Usage

rmvnorm.const(n, mu = rep.int(0, dim(Sigma)[1]), Sigma, Rstruct = NULL,
              A = array(1, c(1,dim(Sigma)[1])), a=0, U=NULL,  ...)
rmvnorm.prec.const(n, mu = rep.int(0, dim(Q)[1]), Q, Rstruct = NULL,
              A = array(1, c(1,dim(Q)[1])), a=0, U=NULL,  ...)
rmvnorm.canonical.const(n, b, Q, Rstruct = NULL,
              A = array(1, c(1,dim(Q)[1])), a=0, U=NULL, ...)

Arguments

n

number of observations.

mu

mean vector.

Sigma

covariance matrix of class spam.

Q

precision matrix.

b

vector determining the mean.

Rstruct

the Cholesky structure of Sigma or Q.

A

Constrain matrix.

a

Constrain vector.

U

see below.

arguments passed to chol.

Details

The functions rmvnorm.prec and rmvnorm.canonical do not requrie sparse precision matrices. For rmvnorm.spam, the differences between regular and sparse covariance matrices are too significant to be implemented here. Often (e.g., in a Gibbs sampler setting), the sparsity structure of the covariance/precision does not change. In such setting, the Cholesky factor can be passed via Rstruct in which only updates are performed (i.e., update.spam.chol.NgPeyton instead of a full chol).

References

See references in chol.

See Also

rmvnorm.spam.

Examples

Run this code
# NOT RUN {
# to be filled in

# }

Run the code above in your browser using DataLab