Comparing Bayesian and Frequentist Approaches

Bayesian Regression Modeling with rstanarm

Jake Thompson

Psychometrician, ATLAS, University of Kansas

The same parameters!

tidy(lm_model)
         term   estimate  std.error statistic      p.value
1 (Intercept) 25.7997778 5.91741208  4.359977 1.627847e-05
2      mom_iq  0.6099746 0.05852092 10.423188 7.661950e-23
tidy(stan_model)
        term   estimate  std.error
1 (Intercept) 25.7257965 6.01262625
2      mom_iq  0.6110254 0.05917996
Bayesian Regression Modeling with rstanarm

Frequentist vs. Bayesian

  • Frequentist: parameters are fixed, data is random
  • Bayesian: parameters are random, data is fixed
  • What's a p-value?
    • Probability of test statistic, given null hypothesis
  • So what do Bayesians want?
    • Probability of parameter values, given the observed data
Bayesian Regression Modeling with rstanarm

Evaluating Bayesian parameters

  • Confidence interval: Probability that a range contains the true value
    • There is a 90% probability that range contains the true value
  • Credible interval: Probability that the true value is within a range
    • There is a 90% probability that the true value falls within this range
  • Probability of parameter values vs. probability of range boundaries
Bayesian Regression Modeling with rstanarm

Creating credible intervals

posterior_interval(stan_model)
                    5%        95%
(Intercept) 16.1396617 35.6015948
mom_iq       0.5131289  0.7042666
sigma       17.2868651 19.3411104
posterior_interval(stan_model, prob = 0.95)
                  2.5%      97.5%
(Intercept) 14.5472824 37.2505664
mom_iq       0.4963677  0.7215823
sigma       17.1197930 19.5359616
posterior_interval(stan_model, prob = 0.5)
                   25%        75%
(Intercept) 21.7634032 29.6542886
mom_iq       0.5714405  0.6496865
sigma       17.8776965 18.7218373
Bayesian Regression Modeling with rstanarm

Confidence vs. Credible intervals

confint(lm_model, parm = "mom_iq", level = 0.95)
           2.5 %    97.5 %
mom_iq 0.4949534 0.7249957
stan_model <- stan_glm(kid_score ~ mom_iq, 
                       data = kidiq)
posterior_interval(stan_model, 
                   pars = "mom_iq", 
                   prob = 0.95)
             2.5%     97.5%
mom_iq 0.4963677  0.7215823
posterior <- spread_draws(stan_model, mom_iq) 
mean(between(posterior_mom_iq, 0.60, 0.65))
0.31475
Bayesian Regression Modeling with rstanarm

Let's practice!

Bayesian Regression Modeling with rstanarm

Preparing Video For Download...