Learn R Programming

condMVNorm (version 2015.2-1)

condMVN: Conditional Mean and Variance of Multivariate Normal Distribution

Description

These functions provide the conditional mean and variance-covariance matrix of [Y given X], where Z = (X,Y) is the fully-joint multivariate normal distribution with mean equal to mean and covariance matrix sigma.

Usage

condMVN(mean, sigma, dependent.ind, given.ind, X.given, check.sigma=TRUE)

Arguments

mean

mean vector, which must be specified.

sigma

a symmetric, positive-definte matrix of dimension n x n, which must be specified.

dependent.ind

a vector of integers denoting the indices of dependent variable Y.

given.ind

a vector of integers denoting the indices of conditoning variable X.

X.given

a vector of reals denoting the conditioning value of X. When both given.ind and X.given are missing, the distribution of Y becomes Z[dependent.ind]

check.sigma

logical; if TRUE, the variance-covariance matrix is checked for appropriateness (symmetry, positive-definiteness). This could be set to FALSE if the user knows it is appropriate.

See Also

dcmvnorm, pcmvnorm, pmvnorm, dmvnorm, qmvnorm

Examples

Run this code
# NOT RUN {
# 10-dimensional multivariate normal distribution
n <- 10
A <- matrix(rnorm(n^2), n, n)
A <- A %*% t(A)

condMVN(mean=rep(1,n), sigma=A, dependent=c(2,3,5), given=c(1,4,7,9),X.given=c(1,1,0,-1))

condMVN(mean=rep(1,n), sigma=A, dep=3, given=c(1,4,7,9), X=c(1,1,0,-1))
# }

Run the code above in your browser using DataLab