Example 3: Accounting for Instructor-level Effects with Bayesian Multilevel Models3 years ago
Introduction: Instructor- or Section-level Effects in Program Evaluation | Example: GLM Not Accounting for Instructor-level Effects | After adjusting for student demographic and background information, the odds ratio comparing those enrolled in the writing center to those not in the writing center is estimated to be R round(exp(coef(fit_glm))['WR_Center'], 2) (95% CI: R round(exp(confint(fit_glm, 'WR_Center'))[1], 2) -- R round(exp(confint(fit_glm, 'WR_Center'))[2], 2)). | Example: Bayesian Multilevel Model Accounting for Instructor-level Effects | The above results show the odds ratio estimate and credible intervals for the impact of the writing center accounting for both the adjustment variables and the instructor-level effects. That is, after adjusting for the student background characteristics (those listed in the model) and instructor-level effects, those that enrolled in the writing center are associated with a R round(mean(OR_WR_Center), 2)-fold increase in the odds for course success in ENG 1 compared to those not enrolled in the writing center (95% credible interval: R round(quantile(OR_WR_Center, 0.025), 2) -- R round(quantile(OR_WR_Center, 0.975), 2)). | ``` | library(knitr) | d_results <- tibble(Model=c('GLM', 'Bayesian Multi-level Model') | , Odds Ratio: WR Center vs. Not=c(exp(coef(fit_glm))['WR_Center'], mean(OR_WR_Center)) | , Lower Limit=c(exp(confint(fit_glm, 'WR_Center'))[1], quantile(OR_WR_Center, 0.025)) | , Upper Limit=c(exp(confint(fit_glm, 'WR_Center'))[2], quantile(OR_WR_Center, 0.975)) | ) | kable(d_results) | ``` | Illustration: Range in Instructor Effects Based on Model | ``` | # Plot instructor-level alphas's posterior mean and 95% credible interval | ggplot(data = a_df, aes(x = Rank, y = Varying_Intercept)) + | geom_pointrange(aes(ymin = Q2.5, ymax = Q97.5), position = position_jitter(width = 0.1, height = 0)) + | geom_hline(yintercept = mean(a_df$Varying_Intercept), size = 0.5, col = "red") + | # scale_x_continuous("Rank", breaks = seq(from = 0, to = 80, by = 5)) + | # scale_y_continuous(expression(paste("varying intercept, ", alpha[j]))) + | theme_bw( base_family = "serif") | References and Further Reading | Appendix: R and R Package Versions
IRexamples 0.0.3Vinh NguyenEx-03-Instructor-Level-Effects-With-Bayesian-Multilevel-Models.Rmd