Brms sampling crashed

Hi everyone,

I’m new with brms. I’ve just experienced a crash in RStudio during sampling. I’ve heard one way to prevent interruptions during sampling is to run shorter chains, save the results, then run new chains starting from the old chains left off (using the ‘inits’ argument), then use combine_models.

However, I don’t know how to use inits in that context. Could someone give a step-by-step example of how to run new chains from old chains with inits?

Many thanks :-)

Example :

brmfit_0  <- brm(pid ~ ageR + ageR2 + cohort + (1 + cohort | country) + (1 | year), 
                data = df_cleaned, 
                family = bernoulli(link = "logit"),
                chains = 2, ## instead of the 4 chains default
                file = "brmfit_0.rds") ## save the results with 2 chains

list_of_inits  <- list(
coef(brmfit_0)
 )

brmfit_1  <- brm(pid ~ ageR + ageR2 + cohort + (1 + cohort | country) + (1 | year), 
                data = df_cleaned, 
                family = bernoulli(link = "logit"),
                chains = 2, 
                inits = list_of_inits, ## to start from old chain
                file = "brmfit_1.rds")

## then combine brmfit_0 and brmfit_1 together