R studio crash after model compilation

218 views
Skip to first unread message

Ben Padilla

unread,
Jun 6, 2022, 4:11:20 PM6/6/22
to nimble-users
Hello all good nimble folks, 

I am having trouble getting a model working. It is an integrated model pulling from multiple data sets with a lot of missing values. When I build the model using nimbleModel() I get a [Note] that the model is not fully initialized, which I recognize is not ideal. I also get a note related to "use of non-constant indexes", which I dont think is a problem. 

When I try to run MCMC with nimbleMCMC() the Rstudio session aborts as soon immediately after compilation of the model. I've attached the model code and the model data here. I think that some of the issues (and my uncertainty in the model code) come in the Observation Models section of the code, which begins at line 86 in the IPMpop_beta script. 

Thanks in advance, 
Ben
IPMpop_beta.R
nimbdata.Rdata

Alison Ketz

unread,
Jun 6, 2022, 4:17:11 PM6/6/22
to nimble...@googlegroups.com

Hi Ben,

Just really a quick response here without looking at your model or anything... if R crashes when you try to run a nimble model, this usually arises because you have invalid values when indexing. i.e. trying to index over a for loop where you specify index values that are 0 or negative.

i.e. it will crash if you have

myvector[0]

or myvector[-19]

The quickest way to debug is go through each index value across each of the for loops. Usually when structuring data this kind of error can occur - esp when things get complicated.

Best,

--Alison

--
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/043b4131-a8a0-4048-9356-782795824357n%40googlegroups.com.

Ben Padilla

unread,
Jun 6, 2022, 4:20:39 PM6/6/22
to nimble-users
Thanks a lot Alison, I will give that a try. 

Ben Padilla

unread,
Jun 6, 2022, 7:29:00 PM6/6/22
to nimble-users
Hi All, 
I am just following up here to note that I did figure out the issue causing R to abort - it was an indexing problem as Alison suggested. I thought I could loop over two values if I specified (e.g., N[1:2] ~ dorm(0,1) ), but I guess not! Now, however, I am getting NaNs for all of my parameters. I am not sure if it is priors, initial values, or an actual model structure/coding error. At this point I am simply trying to get a working model which I will fine-tune with more appropriate priors/initial values later on. 
Thanks, 
Ben
Reply all
Reply to author
Forward
0 new messages