rstanarm (version 2.13.1)

prior_summary.stanreg: Extract and/or print a summary of the priors used for an rstanarm model

Description

Extract and/or print a summary of the priors used for an rstanarm model

Usage

"prior_summary"(object, digits = 2, ...)

Arguments

object
A fitted model object returned by one of the rstanarm modeling functions. See stanreg-objects.
digits
Number of digits to use for rounding.
...
Currently ignored by the method for stanreg objects. The S3 generic uses ... to pass arguments to any defined methods.

Value

A list of class "prior_summary.stanreg", which has its own print method.

Details

For some models you may see "adjusted scale" in the printed output and adjusted scales included in the object returned by prior_summary. These adjusted scale values are the prior scales actually used by rstanarm and are computed by adjusting the prior scales specified by the user to account for the scales of the predictors (as described in the documentation for the scaled argument to prior_options). For models with adjusted prior scales, refitting the model with prior_ops=prior_options(scaled=FALSE) will disable this feature.

Examples

Run this code
if (!exists("example_model")) example(example_model) 
prior_summary(example_model)

priors <- prior_summary(example_model)
names(priors)
priors$prior$scale
priors$prior$adjusted_scale

# for a glm with adjusted scales (see Details, above), compare 
# the default (rstanarm adjusting the scales) to setting 
# prior_ops=prior_options(scaled=FALSE)
fit <- stan_glm(mpg ~ wt + am, data = mtcars, 
                prior = normal(0, c(2.5, 4)), 
                prior_intercept = normal(0, 5), 
                iter = 10, chains = 1) # only for demonstration 
prior_summary(fit)

fit2 <- update(fit, prior_ops = prior_options(scaled = FALSE))
prior_summary(fit2)

Run the code above in your browser using DataCamp Workspace