Re: [R] [Fwd: R2WinBUGS: Comparison to WinBUGS]

From: Hadassa Brunschwig <h.brunschwig_at_utoronto.ca>
Date: Wed 28 Sep 2005 - 19:13:23 EST

Thanks for the tip. That was already helpful. But I am still not satisfied with the results. I now really changed n.thin to the same I had in WinBUGS. It looks like the commands should now be the same. However, I still get differences of 0.6 in the means of interesting parameters which should not be. The plot as well looks completely different. While in WinBUGS I get an approximately Gaussian posterior, this is not the case in R2WinBUGS, it is rather skewed. Does anyone know where the problem could be? As getting a Gaussian posterior is crucial for my work, I dont really know which results i should rely on.

Thanks a lot.

-- 

Hadassa Brunschwig
Birmannsgasse 10A
CH-4055 Basel
Switzerland
Phone: +41 78 797 6065
Email: h.brunschwig@utoronto.ca



Quoting Sibylle Sturtz <sturtz@statistik.uni-dortmund.de>:


> This is due to the following:
>
> In bugs(), the default for thinning is
>
> n.thin = max(1, floor(n.chains * (n.iter - n.burnin)/1000))
>
> which is 29 for n.iter=12000 and n.burnin=2001 as in your example.
> Therefore, the number of iterations used for calculation of posterior
> values is
>
> (12000-2001)/29 = 344.7931
>
> which corresponds to the number of iterations given in your plot. If you
> specify the thinning parameter directly in bugs() it should be fine.
>
> Sibylle
>
> > -------- Original Message --------
> > Subject: [R] R2WinBUGS: Comparison to WinBUGS
> > Date: Wed, 28 Sep 2005 03:55:08 -0400
> > From: Hadassa Brunschwig <h.brunschwig@utoronto.ca>
> > To: r-help@stat.math.ethz.ch
> >
> > Hi R-Help!
> >
> >
> > I used R2WinBUGS and WinBUGS directly on the same model just to compare.
> It
> > seems I am still making a mistake: after running the function bugs() I
> > tried to
> > plot the posteriors of the parameters by using read.bugs() to convert
> > the output
> > to an mcmc object and then plot.mcmc() to plot the densities. Using the
> > same
> > model, the same number of iterations, the same initial values and the
> > same data
> > I get completely different plots for the densities (e.g. the range of one
> > parameter in R2WinBUGS is from 0 to 8 but in WinBUGS only from 1.5 to
> > 3)??? That
> > means my results are different, too.
> > Also, on the plot it says N=345 which is not what I specified in the
> bugs()
> > function (I specified 12000 iterations).
> > Below I put some of the code I used (if that helps):
> >
> > parameters <-
> >
> c("tau","C0","st90","C0.pop","st90.pop","tau.cpop","tau.stpop","st90.pop80")
>
> >
> > inits <- inits <- function(){
> > list(tau = rep(1, 17),tau.cpop = 0.2, tau.stpop = 1)
> > }
> >
> > mcmcA <-
> >
> bugs(dataA,inits,parameters,modelA,n.chains=3,debug=T,n.iter=12000,n.burnin=2001,
>
> >
> > bugs.directory="c:/Program
> > Files/WinBUGS14",working.directory="C:/Documents and
> > Settings/Daikon/Roche/R2WinBUGS Output",codaPkg=T)
> >
> > codaA1 <- read.bugs(mcmcA[1])
> > plot(codaA1)
> >
> >
> > THANKS A LOT!!
>
> --
> Dipl.-Stat. Sibylle Sturtz
> Mathematische Statistik und biometrische Anwendungen
> Fachbereich Statistik
> Universitšt Dortmund
> 44221 Dortmund
> Tel.: 0231/755 4391
> FAX : 0231/755 5303
> ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Wed Sep 28 19:20:44 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 17:51:08 EST