m_simple <- lm(birth_weight_g ~ gestational_age_wks, data = bw)Fitting, assumptions and interpretation with birth weight data
Which maternal and pregnancy factors are associated with infant birth weight, and by how much?
| Variable | Type | Description |
|---|---|---|
birth_weight_g |
outcome | Birth weight (g) |
gestational_age_wks |
numeric | Weeks of gestation |
maternal_age_yrs |
numeric | Mother’s age |
maternal_bmi |
numeric | BMI (kg/m²) |
smoker |
binary | Smoked in pregnancy |
anc_visits |
count | Antenatal visits |
residence |
binary | Urban or rural |
infant_sex |
binary | Female or male |
Figure 1: ?(caption)
Roughly linear, and the smoker line sits below the non-smoker line.
\[ \text{BirthWeight}_i = \beta_0 + \beta_1\,\text{GestAge}_i + \varepsilon_i, \qquad \varepsilon_i \sim N(0, \sigma^2) \]
| Term | Estimate | SE | t | p | CI low | CI high |
|---|---|---|---|---|---|---|
| (Intercept) | -2076.9 | 314.7 | -6.6 | <0.001 | -2695.2 | -1458.6 |
| gestational_age_wks | 135.7 | 8.1 | 16.7 | <0.001 | 119.7 | 151.6 |
Factors use their first level as the reference: no, urban, female.
| Term | Estimate | SE | t | p | CI low | CI high |
|---|---|---|---|---|---|---|
| (Intercept) | -2193.2 | 316.6 | -6.9 | < 0.001 | -2815.3 | -1571.1 |
| gestational_age_wks | 129.7 | 7.7 | 16.9 | < 0.001 | 114.6 | 144.8 |
| maternal_age_yrs | 1.8 | 2.5 | 0.7 | 0.47629 | -3.1 | 6.7 |
| maternal_bmi | 10.6 | 3.8 | 2.8 | 0.00571 | 3.1 | 18.2 |
| smokeryes | -256.3 | 44.1 | -5.8 | < 0.001 | -343.1 | -169.6 |
| anc_visits | 24.3 | 6.7 | 3.6 | < 0.001 | 11.1 | 37.6 |
| residencerural | -100.6 | 27.9 | -3.6 | < 0.001 | -155.5 | -45.7 |
| infant_sexmale | 49.3 | 27.6 | 1.8 | 0.07505 | -5.0 | 103.6 |
Rule of thumb
A binary-factor coefficient is the difference in mean outcome versus the reference group, adjusted for everything else in the model.
For smokeryes: smokers minus non-smokers, at the same gestational age, BMI, age, visits, residence and infant sex.
| R² | Adjusted R² | Residual SE (g) | F | p (F-test) |
|---|---|---|---|---|
| 0.442 | 0.434 | 305.71 | 55.614 | 0 |
| Assumption | Check | |
|---|---|---|
| L | Linearity | Residuals vs fitted; partial residual plots |
| I | Independent errors | Study design |
| N | Normal residuals | Q-Q plot |
| E | Equal variance | Scale-location plot; Breusch-Pagan |
| No collinearity | Variance inflation factors | |
| No unduly influential points | Cook’s distance |
Note: normality applies to the residuals, not to the outcome itself.
Figure 2: ?(caption)
A flat, structureless band around zero supports linearity. A curve suggests a non-linear effect.
Figure 3: ?(caption)
Points should follow the line. Mild tail departures are usually harmless, and with a large sample the coefficient CIs are robust to moderate non-normality.
Figure 4: ?(caption)
Flat smoother is good. Breusch-Pagan test: p = 0.93. The null hypothesis is constant variance, so a small p would signal a problem.
| Predictor | VIF |
|---|---|
| gestational_age_wks | 1.02 |
| maternal_age_yrs | 1.02 |
| maternal_bmi | 1.01 |
| smoker | 1.02 |
| anc_visits | 1.01 |
| residence | 1.03 |
| infant_sex | 1.01 |
Figure 5: ?(caption)
The dashed line is the 4/n screening rule, not a verdict. Largest Cook’s distance here: 0.037. Investigate flagged points, then run a sensitivity analysis without them.
Figure 6: ?(caption)
| Problem | Typical remedy |
|---|---|
| Non-linearity | Polynomial or spline terms; transform the predictor |
| Heteroscedasticity | Log-transform the outcome; robust (HC3) SEs; weighted least squares |
| Skewed or non-normal residuals | Transform the outcome; GLM; bootstrap CIs |
| Correlated errors | Mixed-effects model; cluster-robust SEs; GEE |
| Multicollinearity | Drop or combine variables; ridge regression |
| Influential points | Check the data; sensitivity analysis; robust regression |
| Binary or count outcome | Use logistic or Poisson regression instead |
| GA (wks) | Smoker | Fitted | Mean CI | Individual PI |
|---|---|---|---|---|
| 39 | no | 3268 | 3219 to 3317 | 2666 to 3871 |
| 39 | yes | 3012 | 2925 to 3099 | 2405 to 3619 |
| 36 | no | 2879 | 2816 to 2942 | 2275 to 3483 |
We fitted a multiple linear regression of birth weight (g) on gestational age, maternal age, BMI, smoking, antenatal visits, residence and infant sex (n = 500). After adjustment, each additional week of gestation was associated with 130 g higher birth weight (95% CI 115 to 145), and maternal smoking with 256 g lower birth weight (95% CI -343 to -170). The model explained 43% of the variance (adjusted \(R^2\) = 0.43). Residual diagnostics were examined graphically and with formal tests.
Questions and discussion
Timothy | MozBioMed AI
Linear regression: worked example