Error "Infinite values were detected in model variables: logProb..."

328 views
Skip to first unread message

Dilsad Dagtekin

unread,
Jan 22, 2022, 7:24:39 AM1/22/22
to nimble-users
Hi fellow Nimble users,

I don't have much experience in Nimble, I did several models before, however right now I am stuck with a particular error and hope that you can help me solve it.

I am doing an age-structured CJS model to estimate survival and recapture probabilities. The model I am doing right now is checking effects of sex (categorical, 2-levels Male/Female), age (categorical, 2-levels Juv/Ad), rain (continuous), mean maximum temperature (tempmax, continuous) and the interaction effect of rain and tempax. Also, I am checking random year effect in both parameters.
Model in a nutshell:
 Survival model: logit(phi) <- sex + age + rain + tempmax + rain:tempmax + ryearphi
 Recapture model: logit(p) <- age + rain + tempmax + rain:tempmax + ryearp

This model was running without any problem just before I included rain and tempmax covariates. Now I am getting this error when I try to run the model again with same priors, inits, and MCMC settings:
Infinite values were detected in model variables: logProb_z, logProb_y.
And then after compiling I also get a lot of lines of this error:
...
warning: problem initializing stochastic node z[54, 3]: logProb is -Inf.
warning: problem initializing stochastic node z[55, 3]: logProb is -Inf.
warning: problem initializing stochastic node z[56, 4]: logProb is -Inf.
warning: logProb of data node y[56, 3]: logProb is -Inf.
warning: problem initializing stochastic node z[60, 3]: logProb is -Inf.
warning: logProb of data node y[60, 2]: logProb is -Inf.
warning: problem initializing stochastic node z[72, 4]: logProb is -Inf.
...


My initial thoughts were either my initial values or my priors were not suitable for rain and tempmax (and their interaction effect) slopes, and I tried several alternatives, however I still get the same error.
I'd be appreciated if anyone has any idea on how to solve this. I am attaching the model code and a sample dataset to replicate the error.

Thanks in advance!
Best,
Dilsad
model_X.R
data_X.RData

Daniel Turek

unread,
Jan 23, 2022, 2:52:40 PM1/23/22
to Dilsad Dagtekin, nimble-users
Dilsad, I tried running your code.  When I loaded the dataset you provided (data_X.RData), a number of the covariates which are used in the script weren't present.  That is, the code in "model_X.R" is expecting different variables than are provided in the data file "data_X.RData".  So I added a few lines of code (shown below).  At first I was trying to make accurate guesses (for example, ch, Sex, and seasonal_rain), but then I wasn't sure what some of the variables were, so I just used something with the right dimensions - which I'm pretty sure are not correct.  Anyway, I added these lines (right after loading the data file):

ch <- all_CH    ## NEW
Sex <- sex_dat  ## NEW
seasonal_rain <- Season  ## NEW
seasonal_tempmax <- Season   ## NEW
season_duration = Season[,2]   ## NEW

Doing so, I was able to run through your script, including running the MCMC, without the warnings you were getting.  Furthermore, the sampling seems to be progressing as expected.

Would you mind double-checking the script you sent, along with the data file, and seeing if you still get the same warnings?

Thanks,
Daniel




--
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/c39d1fa7-3474-4813-963f-db1214b0879fn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages