ECON 3209 · Week 10, Lecture 3 · Kerala Agricultural University
Autumn 2026
By the end of this lecture, you will be able to:
statsmodels formula syntaxpandas DataFrame.yield_ ~ fertilizer + rainfall + irrigation.smf.ols(...).fit().For a linear model without interactions or logs, the marginal effect of a regressor equals its estimated coefficient everywhere.
sqrt(mse_resid))coef)std err)coef gives the estimated partial effect.std err shows sampling uncertainty.P>|t| helps test \(H_0: \beta_j=0\).\[t_j = \frac{\hat\beta_j - 0}{se(\hat\beta_j)}\]
If the model is linear in variables, the estimated partial effect of fertilizer is simply \(\hat\beta_{fertilizer}\).
After estimation we can compute
\[\hat{Y}_i = X_i'\hat{\beta}, \qquad \hat{\varepsilon}_i = Y_i - \hat{Y}_i\]
These are useful for: - prediction - residual plots - model checking - scenario analysis
Later weeks extend this idea to interactions, heteroscedasticity-robust inference, and nonlinear models.
“Holding rainfall, irrigation, and soil quality constant, an additional kilogram of fertilizer per acre is associated with an increase of \(\hat\beta_1\) units in expected crop yield.”
This sentence contains: - the conditioning variables - the unit of change in \(X\) - the unit of change in \(Y\) - the direction of the effect
statsmodels.✅ statsmodels makes it easy to estimate, summarize, and visualize MLR models.
✅ The summary table reports fit statistics, coefficient estimates, standard errors, tests, and confidence intervals.
✅ In a linear MLR without interactions, the marginal effect equals the coefficient everywhere.
✅ Prediction grids convert regression output into interpretable visuals and scenarios.
✅ Clear interpretation requires both statistical precision and economic language.
Week 11 — Multicollinearity
We will cover: - what multicollinearity is - how to detect it - why it inflates standard errors - how to diagnose and remedy it in Python
ECON 3209 — Kerala Agricultural University