1

Is there any way to save a jags.model() object into a RData or txt file ?

To perform MCMC on a better computer, I have to save my model on one and using it in a new workspace. But I've some difficulty to use "save()" and "load()" function on R. Thanks for your advices.

Added:

I tried:

jags <- jags.model('regression.bug', data = my.data, n.chains = 4, n.adapt = 1000)

Then I would like save "jags"

save( jags , file="jags.RData")

It's look like if it's saved. But, when I try:

ld.jags <- load( "jags.RData" )

ld.jags

[1] "jags"

And I don't know How I could use "ld.jags" to perform my analysis.

Leon-Alph
  • 87
  • 5
  • 1
    You mention problems with `save` and `load` which are what I'd typically suggest using. Can you add further detail to your question about what you've tried and the problems you encountered when doing so please? – Steph Locke Nov 29 '13 at 14:12
  • `load` will restore a list object to the global environment with the name that it had when saved. `id.jags` is now a character value that has the same characters as the name of that object but it is not the R name. `names` are language objects. If you type the uncommented characters `jags` at the command line you should see the results of `print(jags)`. You don't say what you mean by "perform your analysis"; `jags` is already the results of an earlier analysis. – IRTFM Nov 29 '13 at 17:59
  • Thank you. I'm using `coda` to perform some post-analysis such as `gelman.plot()`, or even a simple `plot()` which is very long to perform because of the uge number of params. I perform JAGS on a computer for 2-3hours and then I would like to save the result on a file for further analysis on another PC. So How can I do? – Leon-Alph Nov 30 '13 at 19:42
  • Do you just want to save the posterior samples for analysis with `coda`? Or do you need to save the model object so that you can update the chains and draw more posterior samples? – Jacob Socolar Dec 02 '15 at 01:57

0 Answers0