| meanvar | R Documentation |
meanvar is a S3 generic function of the class mtrunmnt.
Using the prodmnt, it compute the mean and
variance-covariance matrix for a truncated multivariate normal
distribution.
meanvar(Obj)
Obj |
An mtrunmnt object created by the |
A list with the mean and variance-covariance matrix.
mtrunmnt, meanvarTMD,
mtmvnorm and prodmnt.
### A simple example ####
set.seed(123)
sigma2e <- 1
sigma2a <- 2
n <- 5
mu <- seq(-1,1, length.out = n)
y <- mu + rnorm(1, sd = sqrt(sigma2a)) + rnorm(n, sd = sqrt(sigma2e))
a <- rep(-Inf, n)
b <- rep(Inf, n)
a[y >= 0] <- 0
b[y < 0] <- 0
obj <- mtrunmnt(mu, lower = a, upper = b, Sigmae = sigma2e, D = sigma2a)
meanvar(obj)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.