Please share your Stan program and accompanying data if possible.

I am running RStudio and R (3.6.1) on a linux CentOS 7.2 server with 24 cores and 134 GB dedicated RAM. rstanarm (2.18.2) installed. Created stan_lmer model (13 covariates + 10-level grouping variable) on 1.1 M row dataset using 4 chains. Model completed with all Rhats 1.01 or smaller and sufficient ESS.

median(bayes_R2(model)) aborted R session.


To include mathematical notation in your post put LaTeX syntax between two $ symbols, e.g.,
p(\theta | y) \propto p(\theta) p(y | \theta).

My guess is that it ran out of RAM.

I now have 1.62 TB RAM.

I have run median(bayes_R2(model)) twice.

Each time after 5 to 10 minutes, the R session crashes with the message

fatal error encountered.


Have you tried running bayes_r2(model, re.form=NA)? Perhaps it’s not what you want, but it may help to narrow down the problem.

I forgot to mention that I have now using a stan_lm model, no grouping term.