dtmvnormMvImportSampling: Truncated Multivariate Gaussian density

Description Usage Arguments Value Examples

Description

This function evaluates the truncated multivariate Gaussian density using an important sampling procedure as the normalizing constant

Usage

1
dtmvnormMvImportSampling(X, mn, sig, constr, numSamp = 10000, log = T)

Arguments

X

a vector of observations where each row is the dimension and each column is the independent observations

mn

mean of the multivariate Gaussian density

sig

covariance matrix of the multivariate Gaussian density

constr

a function that describes the domain or constraint of the samples

numSamp

number of samples in the important sampling procedure

log

whether log value is returned (default TRUE)

Value

value of density

Examples

1
2
3
4
5
6
genconst <- function(u1, u2, l1, l2) { in_set <- function(X) {
 if (nrow(X) == 1) X = t(X)
 X[1,] > l1 & X[1,] < u1 & X[2,] > l2 & X[2,] < u2 & X[3,] > l1 &
 X[3,] < u1 & X[4,] > l2 & X[4,] < u2 }}
constr  <- genconst(u1 = 0, u2 = 0, l1 = 1, l2 = 1)
dtmvnormMvImportSampling(X = mvnfast::rmvn(5, mu = rep(0,4), sigma = diag(0.1, 4)), mn = rep(0, 4), sig = diag(0.1,4), constr, numSamp = 1000, log = F)

pasudyan/ConstrMixMod documentation built on May 10, 2019, 8:26 a.m.