Hi Daniel, now it's clear, thank you very much again for a detailed and patient explanation!
On 2021-09-14 15:44, Daniel Turek wrote:
> model$setInits(initsList) does not require recompilation of the model. You can set new values (initial values) into either the uncompiled Rmodel object, or the compiled Cmodel object. But understand, the uncompiled MCMC uses the uncompiled model, and the compiled MCMC uses the compiled model object. So if you're running the compiled MCMC, then you should set new initial values into the compiled model.
>
> model$setInits(initsList) is the same as calling:
> model$variable <- value
> for all the elements in initsList.
>
> I can see why that passage from the manual is confusing. What it means is to say is:
>
> "To change values in the model (which could be flagged as data, or not) without changing which values in the model are flagged as data, use the usual assignment syntax [....] to store these new values into the model. Otherwise, if you store new values into the model using model$setData(...), then you'll store new values into the model, and also modify the data flags in the model. However, if you change the data flags in a compiled model using Cmodel$setData(...), this probably won't accomplish what you want because if you already created an MCMC (and/or compiled it), the the model data flags have already been inspected (at the time of calling configureMCMC) to determine which nodes need to be sampled by the MCMC, so if you change the data flags in the model, it won't change the sampling strategy of the [already-exisiting] MCMC. If you want to change which nodes are data, and have the sampling of the MCMC reflect that, then you'll need to update the model data flags using
> model$setData, then go back to configureMCMC, buildMCMC, and then compile the newly build MCMC algorithm".
>
> But that was too much to put in the manual. The administration just wouldn't have it ;)
>
> Daniel
>
>
>
>
> On Tue, Sep 14, 2021 at 9:11 AM Luca <
pgl...@gmail.com <mailto:
pgl...@gmail.com>> wrote:
>
> Hi Daniel, thank you once more!!
>
> > I will also encourage you to look at chapter 6 (in particular section 6.2) of the NIMBLE user manual, which describes using model objects
>
> I did, and read about the method "...$setInits()", but I wasn't sure whether using that method would require recompilation of the Monte Carlo sampler – I think the Manual is silent on that. This is not a criticism of the Manual though, which is amazing! :)
>