[R] rtmvt

statfan irene_vrbik at hotmail.com
Tue May 31 05:28:28 CEST 2011


I want to use the rtmvt from the  {tmvtnorm} package using the "gibbs"
algorithm but how to i specify the nested function rtmvnorm to use gibbs as
well?

Right now I am using the code:

	for (i in 1:g){
		for (j in 1:n){
			sgamma[,,i,j] = rtmvt(n=50, mean=mu[i,j], sigma[i,j],
			df=nu[i], lower=rep(0,2),algorithm="gibbs")
			}
		}

heres an example of one iteration:
> mu[1,1]
-0.09734357  0.51578628

> sigma[1,1]
          [,1]      [,2]
[1,] 0.4250681 0.0253649
[2,] 0.0253649 0.4250681


when I run this i get 50 errors saying:
Warning messages:
1: In rtmvnorm.rejection(n, mean, sigma, lower, upper, ...) :
  Acceptance rate is very low and rejection sampling becomes inefficient.
Consider using Gibbs sampling.

I have figured out that this is coming from the internal function rtmvnorm
who's default is the rejection algorithm.  Is there any way that I can
specify that to be Gibbs as well? 


Thanks


--
View this message in context: http://r.789695.n4.nabble.com/rtmvt-tp3562217p3562217.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list