I need to fit 500 datasets to a specific model using brms package. Here are the codes.
for (n in 1:500) {
data_pathname <- paste0(workpath2,n,".dat")
data <- read.table(data_pathname)
model <- brm(bf(Y~1+X+(1+X|c|group),sigma~1+(1|c|group)),
data,inits=0,cores=4,sample_prior=T)
result <- summary(model)
}
It works well sometimes. But more often R session aborted. The same thing happened both on Rstudio and RGui. The RAM usage of my server keeps lower than 15% when R running. I find the error happened when the summary() function was called.
How can I solve? Appreciate for any reply.