I'm trying to run a very large simulation in rjags and don't want to keep the
samplers in memory, but rather write them directly to a file. Is there a way
to do this?
Not right now. The design for monitors expects them to retain values in memory
and then write all the values out en bloc. In principle you could write a
new monitor that outputs the current value to the output file stream of your
choice (which would have to be hard coded) but its a bit of a hack.
That's disappointing but neither unexpected nor unreasonable. I appreciate
your response -- thanks!
I was thinking I might try a hack of running just a handful of iterations at a
time, dumping the output, and reading back the last line as the initial
conditions of a new run.
You don't want to start a new run each time because most samplers need an
adaptive phase to tune themselves.
In the rjags interface to R, the current value of the model parameters (i.e.
all the unobserved stochastic nodes) is written back to the jags model object
after each update. You can extract them with the coef() method and write them
to a file.