condMVN {condMVNorm} | R Documentation |
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 conditioning variable X. If specified as integer vector of length zero or left unspecified, the unconditional density is returned. |
X.given |
a vector of reals denoting the conditioning value of X. This should be of the same length as |
check.sigma |
logical; if |
See Also
dcmvnorm
, pcmvnorm
, pmvnorm
, dmvnorm
, qmvnorm
Examples
# 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))
condMVN(mean=rep(1,n), sigma=A, dep=3, given=integer())
# or simply the following
condMVN(mean=rep(1,n), sigma=A, dep=3)