I’m working with a relatively large dataset (~210,000 rows) with multiple random effects. The model is:
photo_rating ~ positiveemotion_baseline_mean + contrast_1 + contrast_2 + (1+contrast_1+contrast_2|country) + (1|unique_id)
where photo_rating is a Likert rating in response to a photo, positive_emotion_baseline_mean is the average response to several Likert questions prior to viewing the set of photos, contrast_1 and contrast_2 are contrast codes of a four-level condition variable, country is a set of ~70 country IDs, and unique_id is a an ID for each participant (total ~21,000 participants).
The model uses the following two priors on contrast_1 and contrast_2:
prior_1 ← prior(cauchy(0, .18), class=b, coef=contrast_1)
prior_2 ← prior(cauchy(0, .25), class=b, coef=contrast_2)
The call to brm is:
m ← brm(photo_rating ~ positiveemotion_baseline_mean + contrast_1 + contrast_2 + (1+contrast_1+contrast_2|country) + (1|unique_id),
prior = c(prior_1, prior_2),
cores = 4,
iter = 1.1e4,
warmup = 1e3,
sample_prior = TRUE,
save_all_pars = TRUE,
data = pos_photo_long
Once the model is estimated, I need to compute a Bayes factor for contrast_1 and contrast_2. I plan to do so using bayestestR::bayesfactor_models. (Before anyone says so, yes, I realize there are reasons not to use Bayes factors; I don’t have much flexibility about the testing approach for this task)
I’ve been having trouble getting the model to fit. I have already successfully fit very similar models to this same dataset (i.e., different outcomes that are not measured multiple times per participant). However, when I try this one, each time one of the chains hangs at the warmup stage without progressing to the sampling stage.
I’ve tried each of the following:
- Reducing the number of samples to, say, 4e3. This doesn’t work because the problem comes at the very beginning of estimation (the chain just hangs at the very beginning of the warmup stage)
- Fitting the model to a smaller subset of the data (~10%). This worked on the subset that I tried
- Changing “inits” to “0”. This didn’t work; some of the chains hung at the beginning
- Changing “init_r” to other values (currently in progress; I’m trying .5). I’m not sure whether this will work yet
I could use advice on how to troubleshoot these problems. Model-fitting takes a long time so troubleshooting this issue is very time-consuming!