Hi Nimble team,
I am trying to test for an effect of food availability on survival (specifically mortality hazard rates) in a capture-recapture (CR) model. Since no clean covariate for food availability is available, I built a model to estimate food availability in each year from raw and messy data. This model on its own runs fine (~20 min), as well as the CR model on its own (~10h). But when I include the food availability module in the CR model, and include an effect of (estimated) food availability on mortality hazard rates, suddenly the model takes much longer to compile (buildMCMC() and compileNimble() steps), requires way more memory, and takes much longer to run.
I made a test with a simulated dataset of modest size (15 years, 30 marked individuals per year, food availability data), and I confirmed that when I include both the CR module and the food module in a single model without including a parameter for an effect of food on mortality, my whole script takes ~30 mins to run. But when I include a parameter for an effect of acorn on mortality, the buildMCMC() and compileNimble() steps last ~5 minutes each instead of seconds, and the model takes >12 hours to run. With my real dataset (30 years of data, ~100 marked individuals in each year), the model becomes prohibitively slow.
Is this to be expected? Is it related to the specifics of my food availability model? Is there a way to speed things up? Any insight would be appreciated.
The model code and the code to simulate data is attached.
Thanks in advance,
Marwan