regression
Linear regression (OLS)
Model a continuous outcome with one or more predictors.
Requirements
- continuous outcome
- predictor(s)
- residual diagnostics
Avoid when
- binary/count/time-to-event outcome
Formula
y = Xβ + ε; β̂ = (XᵀX)⁻¹Xᵀy
Interpretation
Each coefficient is an adjusted mean difference or slope.
Worked example
Model glucose from age, BMI, and treatment group with linear regression.
Open example datasets