Bayesian Educational
Outcomes
Which factors predict how public-school students score in Math, Reading and Writing, and are the gaps by gender and test preparation real? Bayesian regression and MCMC in R on 30,641 students, with missing data filled by model-based imputation.
What moves a test score?
The dataset records 30,641 students: gender, ethnic group, parents' education and marital status, lunch type, test preparation, sport, siblings, transport, weekly study hours, and scores from 0 to 100 in three subjects. Only 19,243 rows are complete. Transport is missing for 10% of students, and parent education and test prep for 6% each.
Dropping a third of the data would bias the answer toward students with complete records, so the first job was filling the gaps carefully.
Impute, fit, prune, check.
What the posterior says.
Mean scores, 95% HPD intervals
| Subject | Female | Male | No test prep | Test prep |
|---|---|---|---|---|
| Reading | 72.6–73.1 | 65.6–66.1 | 66.8–67.3 | 73.5–74.0 |
| Writing | 72.6–73.1 | 63.7–64.2 | 64.9–65.3 | 74.4–75.0 |
| Math | ≈ 64.1 | 68.8–69.1 | 64.7–65.2 | ≈ 69.6 |
With 30,000 students, the intervals are only a few tenths of a point wide, so every gap in the table is clearly real. Two Math cells show sample means.
Gender splits by subject
Girls score about 7 points higher in Reading and 9 in Writing. Boys score about 5 points higher in Math.
Test prep pays, most in writing
Students who completed test prep scored higher in all three subjects, by about 10 points in Writing and 7 in Reading.
Steady predictors
Parents' education, playing sport and the other two subject scores were credible predictors in every model. Lunch type and weekly study hours mattered for Math and Reading.
Imputation as a contest
Choosing each gap's filler by held-out accuracy, rather than one method for everything, kept every student in the analysis.
Where to be careful.
The models lean on the other scores. Each subject's model uses the other two scores as predictors, which is why the accuracy is so high. It explains scores well, but it isn't a forecast from background alone.
Pruning isn't formal model selection. Dropping predictors by credible interval is a practical shortcut. A fuller analysis would compare models with LOO or WAIC.
Imputation adds its own error. Each filled value carries model uncertainty that the downstream regressions don't see. Multiple imputation (for example, mice) would carry it through.