Marginal and Conditional Multivariate Normal Distributions
margcond.RdComputes means and Cholesky factors of covariance or precision matrices of multiple multivariate normal distributions.
Usage
marg_mvnorm(chol, invchol, which = 1L)
cond_mvnorm(chol, invchol, which_given = 1L, given, center = FALSE)Arguments
- chol
Cholesky factors of covariance matrices as
ltMatricesobject, length is recylced to length oflowerandupper.- invchol
Cholesky factors of precision matrices as
ltMatricesobject, length is recylced to length oflowerandupper. Eithercholorinvcholmust be given.- which
names or indices of elements those marginal distribution is of interest.
- which_given
names or indices of elements to condition on.
- given
matrix of realisations to condition on (number of rows is equal to
length(which), the number of columns corresponds to the number of matrices incholorinvchol.- center
logical, if
TRUE, the negative rescaled conditional mean is returned (such that it can be specified ascenterargument toslpmvnorm). By default, the conditional mean is returned.