[R] sampling from the multivariate truncated normal

Uwe Ligges ligges at statistik.tu-dortmund.de
Mon Jun 27 09:01:40 CEST 2011



On 26.06.2011 21:26, statfan wrote:
> I am trying generate a sample for a truncated multivariate normal
> distribution via the rtmvnorm function in the  {tmvtnorm} package.
>
> Why does the following produce NaNs?
>
>
> rtmvnorm(1, mean = rep(0, 2), matrix(c(0.06906084, -0.07463565, -0.07463565,
> 0.08078086),2),c(-0.4316738,  0.8283240),  c(Inf,Inf), algorithm="gibbsR",
> burn.in.samples=100)

Well, for 0.828324 < x[2] < Inf the probablility is roughly 0 hence not 
easy to draw random numbers out there  ....

Uwe Ligges



>
> Thanks
>
> --
> View this message in context: http://r.789695.n4.nabble.com/sampling-from-the-multivariate-truncated-normal-tp3626438p3626438.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list