Dimitri Liakhovitski
2011-Feb-07 18:54 UTC
[R] under what conditions would rtmvnorm (from package tmvtnorm) produce all NaNs
Hello! I am trying to generate a sample from a truncated multivariate normal distribution using rtmvnorm. I am using Gibbs because my alpha (line below) is teeny-tiny ( 4.083475e-64 ) alpha = pmvnorm(lower=lower, upper=upper, mean=btilde, sigma=MyVarCovar). When I try my Gibbs run, it takes quite a long time (with 10,000 iterations and 5,000 iterations burn-in) ~ 22 sec. And then what I get is all NaNs. To add: -I have 67 (!) variables and for a few of them some of my lower and upper bounds are quite close to each other. -In my vector of means some of the values are below respective lower bounds and some are above respective upper bounds. Are the facts above the rasons that my run below returns all NaNs? library(tmvtnorm) myVector = colMeans(rtmvnorm(n=10000, mean = as.vector(btilde), sigma=MyVarCovar, lower=lower, upper=upper, algorithm="gibbs", burn.in.samples=5000)) If one really needs to see the data to answer my question, I'll be happy to provide btilde and my bounds. -- Dimitri Liakhovitski Ninah Consulting www.ninah.com