I have a question regarding
bayes_R2(). From the docs, I understand that
re.form can be used to condition or refrain from conditioning on random effects in mixed models:
The default, NULL, indicates that all estimated group-level parameters are conditioned on.
However, I don’t quite understand the output. Similar to a frequentist framework, I would expect the conditional R2, i.e. the R2 for the model taking random effects into account, to be higher than the “marginal” R2 that only considers fixed effects. In other word, I would expect the point estimate for
bayes_R2(m, re.form = NULL) to be higher than for
bayes_R2(m, re.form = NA).
library(rstanarm) m <- stan_lmer(Sepal.Length ~ Petal.Length + (1 | Species), data = iris, refresh = 0, seed = 333) # The default, NULL, indicates that all estimated # group-level parameters are conditioned on. mean(bayes_R2(m, re.form = NULL)) #>  0.8278072 # "marginal" R2? mean(bayes_R2(m, re.form = NA)) #>  0.9515886
Is there anything I am missing?