condtMVN {condTruncMVN} | R Documentation |
Conditional Truncated Multivariate Normal Parameters
Description
Suppose that Z = (X,Y) is from a fully-joint multivariate normal distribution of dimension n with mean
and covariance matrix sigma
truncated between lower
and upper
. This function provides the parameters for the conditional mean and covariance matrix of Y given X. See the vignette for more information.
Usage
condtMVN(
mean,
sigma,
lower,
upper,
dependent.ind,
given.ind,
X.given,
init = rep(0, length(mean))
)
Arguments
mean |
the mean vector for Z of length of n |
sigma |
the symmetric and positive-definite covariance matrix of dimension n x n of Z. |
lower |
a vector of lower bounds of length n that truncate Z |
upper |
a vector of upper bounds of length n that truncate Z |
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 |
init |
initial value used for random generation of truncated multivariate normal in a Gibbs sampler. Default: A vector of zeros, equal to the number of components. For details, see tmvmixnorm:: |
Details
The first four arguments are the parameters of multivariate normal and the truncation space. dependent.ind, given.ind, X.given, init
are all arguments that determines the conditional truncated MVN.
Using the full data Z, the conditional mean and conditional variance of Y|X are determined (Wang, 2006). Additionally, to reflect the reduced dimension of Y|X, the truncation limits are also adjusted.
See the vignette for more information.
Value
Returns a list of:
condMean - conditional mean of Y|X
condVar - conditional variance of Y|X
condLower - the lower bound of Y|X
condUpper - the upper bound of Y|X
condInit - the initial values adjusted to match the dimension of Y|X. These are used to randomly generate the truncated multivariate normal rcmvtruncnorm.
Note
This function is based on condMVN
from the condMVNorm package.
References
Wang, R. 2006. Appendix A: Marginal and conditional distributions of multivariate normal distribution. http://fourier.eng.hmc.edu/e161/lectures/gaussianprocess/node7.html.
See Also
Examples
# Suppose X2,X3,X5|X2,X4 ~ N_3(1, Sigma) and truncated between -10 and 10.
d <- 5
rho <- 0.9
Sigma <- matrix(0, nrow = d, ncol = d)
Sigma <- rho^abs(row(Sigma) - col(Sigma))
# Conditional Truncated Normal Parameters
condtMVN(mean = rep(1, d),
sigma = Sigma,
lower = rep(-10, d),
upper = rep(10, d),
dependent.ind = c(2, 3, 5),
given.ind = c(1, 4), X.given = c(1, -1)
)