Learn R Programming

valueprhr (version 0.1.0)

get_r2_values: Extract R-squared Values from rstanarm Model

Description

Attempts to extract R-squared using loo_R2, falling back to bayes_R2.

Usage

get_r2_values(fit, verbose = FALSE)

Value

A named numeric vector with mean, median, and mode R-squared values.

Arguments

fit

A fitted rstanarm model object.

verbose

Logical. Print messages about extraction method. Default FALSE.

Examples

Run this code
# \donttest{
if (requireNamespace("rstanarm", quietly = TRUE)) {
  data(mtcars)
  fit <- rstanarm::stan_glm(mpg ~ wt, data = mtcars,
                            chains = 2, iter = 1000, refresh = 0)
  get_r2_values(fit)
}
# }

Run the code above in your browser using DataLab