Jurgis SAPIJANSKAS
2012-Mar-20 14:27 UTC
[R] rtmvtnorm and equal upper and lower truncation boundaries in 'tmvtnorm' package
Dear list, I am facing a problem with the rtmvtnorm function to sample from a truncated multivariate normal when some of the truncation boundaries are equal, e.g.:>rtmvnorm(1, mean = rep(0,3), sigma = diag(3), lower=c(-1,0,-1),upper=c(1,0,1), algorithm="gibbs") Error in checkTmvArgs(mean, sigma, lower, upper) : lower must be smaller than or equal to upper (lower<=upper) Of course, since it is all about numerics I could do>rtmvnorm(1, mean = rep(0,3), sigma = diag(3), lower=c(-1,0,-1),upper=c(1,1e-16,1), algorithm="gibbs") [,1] [,2] [,3] [1,] -0.6221186 0 -0.6435531 but it is not entirely satisfying. Is it a normal behaviour of rtmvtnorm? Thanks in advance, jurgis [[alternative HTML version deleted]]