Different initial values for each chain

147 views
Skip to first unread message

Matthijs Hollanders

unread,
Jan 23, 2023, 4:39:04 PM1/23/23
to nimble-users
Hi all,

I'm sorry if this has been documented elsewhere but I haven't been able to find it. I'm wondering, what's the best way to set new initial values for each chain? If I'm understanding correctly, using a function for initial values in nimbleModel() only uses fresh values for the first chain, where the subsequent chains start where the previous one left off. I think using a initial values in runMCMC() does start new initial values, but only for those nodes where a new initial values are assigned. I've been using that method, but for subsequent chains I always get a bunch of error messages for some nodes. I think this is due to my new initial values corresponding some of the nodes that aren't reset contradicting those nodes. I think nimble does a good job of fixing these errors after the first iteration, but it'd be nice not to get them at all, and I'm sure things won't always go smoothly.

Is there a way to start fully "fresh" MCMC chains, where any nodes that aren't provided initial values are simulated by nimble, using runMCMC()?

Thanks!

Matt

Perry de Valpine

unread,
Jan 25, 2023, 2:51:36 PM1/25/23
to Matthijs Hollanders, nimble-users
Hi Matt,

Thanks for the question.  I think I follow what you're saying.  The MCMC initializer (called as almost the very first step of running an MCMC) will draw values for nodes that are NA from their priors.  I think you could get the behavior you want if the inits you provide to runMCMC (whether as a list or a function) puts NAs in the nodes that you want drawn freshly from their priors (after other inits values are assigned).

(For full control, you could skip runMCMC and set up the model's values however you like and then call mcmc$run(...), but I'm assuming you'd prefer to stick with runMCMC.)

HTH!
Perry


--
You received this message because you are subscribed to the Google Groups "nimble-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nimble-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nimble-users/35172d26-6489-4323-aa16-d7b104a1d000n%40googlegroups.com.

Matthijs Hollanders

unread,
Jan 28, 2023, 3:57:39 AM1/28/23
to nimble-users
Thanks Perry. Makes sense!
Reply all
Reply to author
Forward
0 new messages