[R] R2WinBUGS: Comparison to WinBUGS

Hadassa Brunschwig h.brunschwig at utoronto.ca
Wed Sep 28 09:55:08 CEST 2005


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!!
-- 

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




More information about the R-help mailing list