Compute LOO-adjusted R2.
r2_loo(model, verbose = TRUE)
model | A Bayesian regression model. |
---|---|
verbose | Toggle off warnings. |
The LOO-adjusted R2 for model
, as numeric value.
Unlike r2_bayes
, which returns an "unadjusted" R2 value,
r2_loo()
calculates a LOO-adjusted R2, which comes conceptionally
closer to an "adjusted" R2 measure.
if (require("rstanarm")) { model <- stan_glm(mpg ~ wt + cyl, data = mtcars, chains = 1, iter = 500, refresh = 0) r2_loo(model) }#> Warning: Some Pareto k diagnostic values are slightly high. See help('pareto-k-diagnostic') for details.#> LOO-adjusted R2 #> 0.7908119