Saving jags.model in RData file
Asked Answered
G

0

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.

Gravel answered 29/11, 2013 at 14:4 Comment(4)
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?Mitosis
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.Swatch
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?Gravel
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?Advertence

© 2022 - 2024 — McMap. All rights reserved.