Bayesian Regression Modeling with rstanarm
Jake Thompson
Psychometrician, ATLAS, University of Kansas
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
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
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