A (still experimental) simple user interface for computing on multiple multivariate normal distributions.
mvnorm(mean, chol, invchol)
# S3 method for mvnorm
aperm(a, perm, ...)
margDist(object, which, ...)
# S3 method for mvnorm
margDist(object, which, ...)
condDist(object, which_given, given, ...)
# S3 method for mvnorm
condDist(object, which_given, given, ...)
# S3 method for mvnorm
simulate(object, nsim = dim(object$scale)[1L], seed = NULL,
standardize = FALSE, as.data.frame = FALSE, ...)
# S3 method for mvnorm
logLik(object, obs, lower, upper, standardize = FALSE, ...)
# S3 method for mvnorm
lLgrad(object, obs, lower, upper, standardize = FALSE, ...)
mvnorm
, margDist
, and condDist
return objects
of class mvnorm
. logLik
returns the log-likelihood
and lLgrad
a list with gradients.
either an ltMatrices
object specifying (multiple)
Cholesky factors of the covariance matrix or
one single numeric lower triangular square matrix.
either an ltMatrices
object specifying (multiple)
inverse Cholesky factors of the covariance matrix or
one single numeric lower triangular square matrix.
objects of class mvnorm
.
a permutation of the covariance matrix corresponding to a
.
names or indices of elements those marginal distribution is of interest.
names or indices of elements to condition on.
matrix of realisations to condition on (number of rows is
equal to length(which)
, the number of
columns corresponds to the number of matrices in chol
or invchol
.
matrix of lower limits (one column for each observation, \(J\) rows).
matrix of upper limits (one column for each observation, \(J\) rows).
matrix of exact observations (one column for each observation, \(J\) rows).
matrix of means (one column for each observation, length is
recycled to length of obs
, lower
and upper
).
an object specifying if and how the random number generator
should be initialized, see simulate
.
logical, should the Cholesky factor (or its inverse) undergo standardization (ensuring the covariance matrix is a correlation matrix) before computing the likelihood.
number of samples to draw.
logical, convert the $J x N$ matrix result to a classical $N x J$ data frame.
Additional arguments to ldpmvnorm
and
sldpmvnorm
The constructor mvnorm
can be used to specify (multiple)
multivariate normal distributions. margDist
derives marginal and
condDist
conditional distributions from such objects. A
simulate
method exists for drawn samples from multivariate
normals.
The continuous (data in obs
), discrete (intervals in lower
and upper
), and mixed continuous-discrete log-likelihood is
implemented in logLik
. The corresponding gradients with respect
to all model parameters and with respect to the data arguments
is available from lLgrad
.
Rationals and examples are given in Chapter 7 of the package vignette linked to below.
vignette("lmvnorm_src", package = "mvtnorm")