Returns the prior that rstanarm placed on each parameter of a
rstanarm::stan_glm() fit, after autoscaling. For
rstanarm::stan_glmer() fits, the population-level parameters are
returned; the group-level covariance prior is described by
rstanarm::prior_summary(fit)$prior_covariance. rstanarm's
rstanarm::prior_summary() prints the same information; this function
returns it as a data frame.
Arguments
- fit
A
stanregobject fromrstanarm::stan_glm(),rstanarm::stan_glmer()orfit_model_with_prior(), fitted withoutQR = TRUE.
Value
A data frame with one row per parameter and columns variable,
role ("intercept", "slope" or "aux"), dist, location,
scale, df, prior_sd (the prior standard deviation, Inf when it
does not exist) and prior (a readable description).
Details
The intercept row describes the prior on the intercept at the predictor
means, which is the parameter rstanarm places its prior on. Auxiliary
parameters (e.g. sigma) have half-distributions on the positive real
line, except for the exponential.
Examples
# \donttest{
data(kidiq, package = "rstanarm")
fit <- rstanarm::stan_glm(kid_score ~ mom_iq, data = kidiq,
chains = 2, iter = 1000, refresh = 0)
prior_table(fit)
#> variable role dist location scale df prior_sd
#> 1 (Intercept) intercept normal 86.79724 51.026721 NA 51.026721
#> 2 mom_iq slope normal 0.00000 3.401781 NA 3.401781
#> 3 sigma aux exponential NA 20.410688 NA 20.410688
#> prior
#> 1 normal(86.8, 51)
#> 2 normal(0, 3.4)
#> 3 exponential(rate = 0.049)
# }