Sometimes, if we forget to save BUGS output, we run into a nightmare of fitting the model all over again. This would mean thousands of iteration and couple hours. But here is the tip for situation like this. If you fit your model through R2WinBUGS, you might have code files left in your working directory.
Converting coda files into BUGS objects.
Let say our coda files are: coda1.txt, coda2.txt, coda3.txt and codaIndex.txt.
setwd("d:\tmp") # set your working directory to where coda files are
bugs.fit <- R2WinBUGS:::bugs.sims(c("mu", "sigma", "theta"), n.chains=3, n.iter=6000, n.burnin=1000, n.thin=1, DIC = FALSE)
# you need to read coda files to know and input these numbers
class(bugs.fit) <- "bugs"
If you did save DIC as log.txt from WinBUGS, then:
bugs.fit$is.DIC <- TRUE
If not, then:
bugs.fit$is.DIC <- FALSE
After these steps, bugs.fit will be a bugs object again. You can save it save("bugs.fit", file="bugsfit"). Or do the analysis like:
2 hours ago