[R] rtmvt

From: statfan <irene_vrbik_at_hotmail.com>
Date: Mon, 30 May 2011 20:28:28 -0700 (PDT)

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?


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.

R-help_at_r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Tue 31 May 2011 - 04:09:04 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 31 May 2011 - 04:10:10 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive