= Solution
Both fits use the Gaussian <generalized additive model>
$$
Y_i=\alpha+f_e(e_i)+f_d(d_i)+\varepsilon_i,\qquad
\varepsilon_i\overset{\mathrm{iid}}\sim N(0,\sigma^2),
\qquad\sum_i f_e(e_i)=\sum_i f_d(d_i)=0,
$$
where $e_i$ is experience and $d_i$ education. Centering makes the additive decomposition identifiable. No experience-education <interaction term> is included.
The first fit uses <local linear regression> for each term. `span=1` includes all observations in each nearest-neighbour neighbourhood, but distance weights and a moving target still vary: it does not make the fit exactly a global straight line. The second uses <cubic smoothing splines>, with separate tuning values `spar=0.8` and `spar=1.2`. Increasing `spar` increases the curvature penalty and smooths more; `spar` is a monotone tuning parametrization, not the numerical $\lambda$ in part (b). The relation depends on the predictor scaling and design.
The plotted experience effect is increasing in both fits. The local fit gives a broadly smooth, nearly linear rise; the spline fit follows more of the steep low-experience rise and subsequent flattening, especially near the lower boundary. Education has a weaker increasing effect. The local estimate shows some curvature, while the spline fit at `spar=1.2` is closer to a straight line. \b[The clearest difference is the amount of smoothing and the experience curvature, rather than opposite effect directions.] These are centered partial-effect plots with <partial residuals>, not scatterplots of wage against each predictor alone.
A smaller local span would allow the first fit to capture more experience curvature. A moderately smaller education `spar` could reveal nonlinear detail suppressed in the second fit; its small but significant nonparametric component in part (e) supports checking that possibility. Do not tune solely to follow every point, especially at sparse boundaries. Compare candidate spans or separate spline penalties using <cross-validation> or <generalized cross-validation>; increase smoothing if flexible fits introduce unsupported wiggles. See the documented monotone `spar`–penalty convention at https://stat.ethz.ch/R-manual/R-patched/library/stats/html/smooth.spline.html.
Back to article page