This workflow shows how the measurement scale of an outcome determines the regression model. Related predictors are used to model a continuous score, a count, an ordered rating, and a binary milestone so that coefficients, assumptions, predictions, and reporting can be compared directly.
| Outcome | Example | Model in this workflow | Main effect scale |
|---|---|---|---|
| Continuous | Assessment score | Linear regression | Mean difference |
| Count | Advising visits | Poisson or negative-binomial regression | Expected count ratio |
| Ordinal | Ordered progress rating | Proportional-odds regression | Cumulative odds ratio |
| Binary | Milestone reached: yes/no | Logistic regression | Odds ratio |
This workflow covers counts observed over a common opportunity period. Rates with unequal exposure require an offset. Repeated measures, clustered observations, and time-to-event outcomes need models designed for those structures.
Rows: 500
Columns: 10
$ student_id <chr> "S001", "S002", "S003", "S004", "S005", "S006", "S007~
$ age <dbl> 22, 35, 30, 40, 22, 41, 27, 33, 37, 32, 23, 37, 36, 3~
$ first_generation <fct> No, No, No, No, Yes, Yes, Yes, No, No, No, No, No, Ye~
$ study_hours <dbl> 7.5, 9.5, 7.1, 15.4, NA, 15.7, 6.5, 10.7, 16.7, 11.5,~
$ preparation <dbl> 69.4, 59.6, 47.1, 56.5, 64.1, 94.2, 73.3, 64.4, 66.8,~
$ support <fct> Enhanced, Enhanced, Standard, Enhanced, Standard, Enh~
$ score <dbl> 68.1, 63.0, 53.2, 67.3, 64.7, 76.8, 65.1, 64.4, 75.8,~
$ advising_visits <dbl> 0, 0, 4, 2, 1, 1, 9, 3, 0, 4, 1, 2, 3, 2, 9, 4, 3, 2,~
$ rating <ord> Advanced, Proficient, Developing, Proficient, Beginni~
$ milestone <int> 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1,~
| stage | n |
|---|---|
| Imported records | 500 |
| Complete cases | 482 |
| Excluded for missing analysis values | 18 |
| variable | missing_n | missing_percent |
|---|---|---|
| student_id | 0 | 0.0 |
| age | 0 | 0.0 |
| first_generation | 0 | 0.0 |
| study_hours | 18 | 3.6 |
| preparation | 0 | 0.0 |
| support | 0 | 0.0 |
| score | 0 | 0.0 |
| advising_visits | 0 | 0.0 |
| rating | 0 | 0.0 |
| milestone | 0 | 0.0 |
| term | estimate | std.error | statistic | p.value | conf.low | conf.high |
|---|---|---|---|---|---|---|
| (Intercept) | 27.679 | 3.155 | 8.774 | 0.000 | 21.480 | 33.878 |
| preparation | 0.425 | 0.031 | 13.861 | 0.000 | 0.365 | 0.485 |
| study_hours | 0.784 | 0.094 | 8.361 | 0.000 | 0.600 | 0.968 |
| supportEnhanced | 4.049 | 0.752 | 5.382 | 0.000 | 2.571 | 5.527 |
| first_generationYes | -2.688 | 0.766 | -3.508 | 0.000 | -4.194 | -1.182 |
| age | 0.085 | 0.055 | 1.546 | 0.123 | -0.023 | 0.193 |
Each coefficient is an adjusted mean difference in the score. The intercept describes the predicted score when numeric predictors equal zero, so it may not be substantively meaningful without centering.
Also review independence from the design, influential cases, linearity for continuous predictors, and uncertainty estimates appropriate to the sampling structure. A flag prompts investigation; it is not an automatic deletion rule.
| poisson_dispersion | selected_model |
|---|---|
| 1.807 | negative-binomial |
| term | estimate | conf.low | conf.high | p.value |
|---|---|---|---|---|
| (Intercept) | 2.637 | 1.412 | 4.927 | 0.002 |
| preparation | 0.992 | 0.985 | 0.998 | 0.010 |
| supportEnhanced | 0.903 | 0.774 | 1.054 | 0.195 |
| first_generationYes | 1.140 | 0.976 | 1.333 | 0.099 |
| age | 1.014 | 1.003 | 1.026 | 0.014 |
Exponentiated coefficients are expected count ratios because every record has the same observation opportunity in this example. Call them rate ratios only when the model includes a defensible exposure offset. The Poisson model assumes equality of the conditional mean and variance. The Pearson dispersion estimate above is used as a screening diagnostic; the worked example switches to a negative-binomial model when overdispersion is substantial. Excess zeros, exposure time, clustering, and repeated counts need additional consideration.
| term | estimate | conf.low | conf.high | p.value |
|---|---|---|---|---|
| preparation | 1.048 | 1.034 | 1.063 | 0.000 |
| study_hours | 1.056 | 1.013 | 1.101 | 0.010 |
| supportEnhanced | 1.886 | 1.353 | 2.638 | 0.000 |
| first_generationYes | 1.078 | 0.773 | 1.504 | 0.658 |
| age | 0.991 | 0.968 | 1.016 | 0.484 |
An odds ratio above 1 indicates higher cumulative odds of being in a higher rating category, conditional on the other predictors. The proportional-odds model assumes that each predictor has the same log-odds effect at every cumulative split.
| term | Df | logLik | AIC | LRT | Pr(>Chi) |
|---|---|---|---|---|---|
| preparation | NA | NA | NA | NA | NA |
| study_hours | NA | NA | NA | NA | NA |
| support | NA | NA | NA | NA | NA |
| first_generation | NA | NA | NA | NA | NA |
| age | NA | NA | NA | NA | NA |
Small likelihood-ratio p-values indicate that allowing a predictor to vary across cumulative splits improves fit, which raises concern about proportional odds. Interpret these tests with category counts, graphical checks, theory, and multiplicity in mind; do not automatically replace the model after one small p-value.
| term | estimate | conf.low | conf.high | p.value |
|---|---|---|---|---|
| (Intercept) | 0.018 | 0.003 | 0.109 | 0.000 |
| preparation | 1.043 | 1.025 | 1.062 | 0.000 |
| study_hours | 1.068 | 1.013 | 1.128 | 0.016 |
| supportEnhanced | 1.692 | 1.112 | 2.591 | 0.015 |
| first_generationYes | 0.575 | 0.367 | 0.890 | 0.014 |
| age | 0.982 | 0.952 | 1.013 | 0.256 |
Odds ratios are not risk ratios. Predicted probabilities often communicate practical magnitude more clearly, especially when the outcome is common.
Linear, count, proportional-odds, and logistic regression models were fitted to 482 complete synthetic records. Holding study hours, support condition, first-generation status, and age constant, a one-point increase in preparation was associated with a 0.42-point difference in assessment score, 95% CI [0.36, 0.48], p < .001. The linear model explained 38.8% of score variance.
The Poisson dispersion statistic was 1.81, so a negative-binomial model was used for advising visits. Each one-point increase in preparation corresponded to an expected count ratio of 0.99, 95% CI [0.99, 1], p = .010. Every record had the same observation opportunity; a rate model would require an exposure offset.
For the ordered progress rating, each one-point increase in preparation corresponded to 1.05 times the cumulative odds of a higher category, 95% CI [1.03, 1.06]. In the binary milestone model, the adjusted odds ratio was 1.04, 95% CI [1.02, 1.06], p < .001. Interpret these estimates on their model-specific scales and alongside predicted values, diagnostics, study design, and substantive importance.
| file |
|---|
| synthetic_regression_outcomes.csv |
| linear_model_results.csv |
| count_model_results.csv |
| ordinal_model_results.csv |
| proportional_odds_review.csv |
| logistic_model_results.csv |
| logistic_calibration.csv |
| run_settings.csv |
| package_versions.csv |