Multiple Linear Regression: Ordinary Least Squares Derivation & Diagnostics
by Rao Statistics · Last updated on 1 Nov 2026 · 4.1 Multiple Linear Regression
From matrix formulation and Gauss-Markov assumptions to model assessment in R and Python
Learning Objective
By the end of this lesson: Formulate a multiple linear regression model in matrix notation, estimate regression coefficients using OLS, calculate adjusted and F-statistics, and detect multicollinearity via Variance Inflation Factors (VIF).
Statistical Theory & Assumptions
In multiple linear regression, we model the conditional expectation of a response variable as a linear function of explanatory variables: where and The Ordinary Least Squares (OLS) estimator minimizes the sum of squared residuals
Assumptions
- Linearity in Parameters: The relationship between predictors and the mean response is linear in the parameters
- Strict Exogeneity: The expected value of errors given X is zero:
- No Multicollinearity: The matrix has full column rank meaning no exact linear dependency exists among regressors.
- Homoscedasticity & Independence: Errors have constant variance and are uncorrelated: for
The vector of estimated coefficients is obtained by solving the system of normal equations with covariance matrix
Worked Dataset & Variables
Concrete Compressive Strength Laboratory Data: Engineering experimental observations measuring 28-day compressive strength (MPa) based on Water-Cement Ratio Fly Ash content (kg/m³), and Curing Temperature (°C). (sample size n = 30).
| Variable | Type | Description |
|---|---|---|
| sample_id | Integer | Batch test specimen code |
| w_c_ratio | Numeric | Water to cementitious materials ratio |
| fly_ash | Numeric | Fly ash proportion (kg/m³) |
| curing_temp | Numeric | Curing temperature in Celsius |
| strength_mpa | Numeric | Compressive strength in MPa (Response Y) |
| sample_id | w_c_ratio | fly_ash | curing_temp | strength_mpa |
|---|---|---|---|---|
| 1 | 0.42 | 50 | 21 | 42.6 |
| 2 | 0.45 | 45 | 20 | 38.9 |
| 3 | 0.38 | 60 | 22 | 47.1 |
| 4 | 0.5 | 30 | 19 | 33.4 |
| 5 | 0.4 | 55 | 23 | 45.2 |
Software Procedure (R, Python & Excel)
# Fit multiple linear regression model
fit <- lm(strength_mpa ~ w_c_ratio + fly_ash + curing_temp, data = concrete_data)
summary(fit)
# Calculate Variance Inflation Factors (VIF)
car::vif(fit)
# Diagnostic plots
par(mfrow = c(2, 2))
plot(fit)Numerical Results
The estimated OLS model demonstrates high explanatory fidelity. Water-cement ratio shows a strong negative association with strength, while fly ash and temperature contribute positively.
| Statistic | Value | Note |
|---|---|---|
| Intercept (β₀) | +68.42 | p < 0.001 |
| β₁ (w_c_ratio) | -72.35 | t = -7.81, p < 0.0001 |
| β₂ (fly_ash) | +0.142 | t = +4.12, p = 0.0003 |
| β₃ (curing_temp) | +0.618 | t = +2.48, p = 0.019 |
| Coefficient of Determination (R²) | 0.842 | 84.2% variance explained |
| Adjusted R² | 0.824 | Penalized for predictor count |
| Overall F-Statistic | 46.21 (df=3, 26) | p < 0.0001 |
| Max VIF observed | 1.45 | Well below threshold of 5.0 (No collinearity) |
Interpretation & Decision Rule
Formal conclusion: The overall model is statistically significant at the level The three explanatory variables account for 84.2% of the total variability in 28-day concrete strength.
Decision rule: Each regression coefficient exhibits a p-value strictly below 0.05, confirming that all three regressors contribute unique linear explanatory power to compressive strength.
Practical significance: Controlling the water-cement ratio is the paramount determinant: each 0.05 increase in the w/c ratio reduces expected compressive strength by approximately 3.6 MPa, holding fly ash and temperature fixed.
Gauss-Markov Optimality: Under the Gauss-Markov assumptions (uncorrelated errors with constant variance), the OLS estimator is the Best Linear Unbiased Estimator (BLUE), achieving minimum variance among all linear unbiased estimators.
Practice Files
Download: concrete_compressive_strength_experiment.csv (CSV Dataset, 2.8 KB)