ECON 3209 · Week 14, Lecture 2 · Kerala Agricultural University
Autumn 2026
By the end of this lecture, you will be able to:
Sometimes a single straight line is too simple, but a global polynomial is too rigid or unstable.
Piecewise models let the slope change after a chosen threshold, called a knot.
For a knot at \(c\), define
\[H(X-c)=\max(0, X-c)\]
Then estimate
\[Y = \beta_0 + \beta_1 X + \beta_2 H(X-c) + \varepsilon\]
Before the knot, slope is \(\beta_1\); after the knot, slope is \(\beta_1 + \beta_2\).
Example: income may rise quickly with landholding up to 3 hectares, then more slowly.
Possible strategies: - theoretical threshold - median or quartile cut-off - visible bend in the scatter plot - compare candidate models with AIC/BIC
There is no universal best knot without context.
land.land plus coefficient on hinge3.If the hinge coefficient is negative, the relationship becomes flatter after the knot.
Splines give flexibility while keeping interpretation manageable.
np.maximum(0, land - 3).✅ Piecewise models allow different slopes in different ranges of a regressor.
✅ A knot marks the point where the slope is allowed to change.
✅ Hinge variables provide a simple way to estimate spline-like models in Python.
✅ Comparing different knots or functional forms with AIC/BIC helps guide choice.
✅ Piecewise fits are often easier to interpret than high-order polynomials.
Lecture 3 — Python Curve Fitting
We will cover: - numpy.polyfit - scipy.optimize.curve_fit - AIC/BIC comparison - choosing among nonlinear fits
ECON 3209 — Kerala Agricultural University