User Specified Priors

Bayesian Regression Modeling with rstanarm

Jake Thompson

Psychometrician, ATLAS, University of Kansas

Why change the default prior?

  • Good reason to believe the parameter will take a given value
  • Constraints on parameter
Bayesian Regression Modeling with rstanarm

Specify a prior

stan_model <- stan_glm(kid_score ~ mom_iq, data = kidiq,
  prior_intercept = normal(location = 0, scale = 10),
  prior = normal(location = 0, scale = 2.5),
  prior_aux = exponential(rate = 1)
)
Bayesian Regression Modeling with rstanarm

Specify a prior

stan_model <- stan_glm(kid_score ~ mom_iq, data = kidiq,
  prior_intercept = normal(location = 0, scale = 10, autoscale = FALSE),
  prior = normal(location = 0, scale = 2.5, autoscale = FALSE),
  prior_aux = exponential(rate = 1, autoscale = FALSE)
)
Bayesian Regression Modeling with rstanarm

Specify a prior

stan_model <- stan_glm(kid_score ~ mom_iq, data = kidiq,
  prior_intercept = normal(location = 3, scale = 2),
  prior = cauchy(location = 0, scale = 1))
  • Many different priors
    • normal()
    • exponential()
    • student_t()
    • cauchy()
  • ?priors
Bayesian Regression Modeling with rstanarm

Flat priors

stan_model <- stan_glm(kid_score ~ mom_iq, data = kidiq,
  prior_intercept = NULL,
  prior = NULL,
  prior_aux = NULL)
prior_summary(stan_model)
Priors for model 'stan_model' 
 ------
Intercept (after predictors centered)
 ~ flat

Coefficients
 ~ flat

Auxiliary (sigma)
 ~ flat
 ------
See help('prior_summary.stanreg') for more details
Bayesian Regression Modeling with rstanarm

Let's practice!

Bayesian Regression Modeling with rstanarm

Preparing Video For Download...