Short summary of the problem:
Hi…I am fitting a nonlinear multilevel model to analyze survival probability of individuals (0/1 response) in relation to two continuous predictors CON and HET. We know that the relationship follows the form:
y[i] = b0[i,j] + b1[i,j]* CON^c1[i,j] + b2[i,j]* HET^c2[i,j]
Here, y is the log odds of survival and b0, b1, b2, c1 and c2 are parameters that have to be estimated from the data. Individuals (i) are distributed among j groups. All coefficients vary with group. In addition, all coefficients are linear functions of another predictor ‘AB’., i.e., each b/c ~ AB + random effects for groups.
This is a large dataset of ~150,000 data points and j = 190 groups. I formulated the model as shown below:
# set priors priors = c( set_prior("normal(0, 1)", nlpar = "b0"), set_prior("normal(0, 1)", nlpar = "b1"), set_prior("normal(0, 1)", nlpar = "b2"), set_prior("normal(0, 1)", nlpar = "c1"), set_prior("normal(0, 1)", nlpar = "c2") ) cores = 6 chains = 3 control = list(adapt_delta = 0.9) reuse_models = TRUE fit_test = brm( bf(status ~ b0 + (b1 * dBA.con.15m^c1) + (b2 * dBA.het.15m^c2), b0 ~ 1 + abundance + (1|sp) ,#+(1|quadrat), # (1|year) + b1 ~ 1 + abundance + (1|sp), b2 ~ 1 + abundance + (1|sp), c1 ~ 1 + abundance + (1|sp), c2 ~ 1 + abundance + (1|sp), nl = TRUE), data = dat.test, family = bernoulli(link = "logit"), prior = priors, save_model = "brm_cndd_bci.txt", chains = chains, cores = cores, seed = 123, control = control, inits = 0 )
When I tried this model with a small subset of the data, running 4 chains for 2000 iterations, the model converged and seemed to give sensible parameter estimates. However, when I run the model with the full data or larger subsets (30%. 60%, 80% of data points), one of the chains consistently ‘hangs’. Sampling stops usually just after warmup is done for this chain. I have let the ‘hung’ chain continue for up to 4 hours, with no progress. I have not been able to fix the problem even with running simpler versions of the model or using smaller subsets of the data.
- Have I specified the nonlinear model correctly in brms?
- I just moved to a new laptop (Windows 10) and updated to R version 4.0.2 and brms version 2.13.5. I was initially having problems with even starting the sampling , which got resolved by uninstalling and reinstalling brms. Could this be a sampling problem with rstan?
I hope this information suffices to explain the problem. Would much appreciate your help!