Description Usage Arguments Value Examples
This function evaluates the truncated multivariate Gaussian density using an important sampling procedure as the normalizing constant
1 | dtmvnormMvImportSampling(X, mn, sig, constr, numSamp = 10000, log = T)
|
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 of density
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.