= Solution
Because no family is specified, the command fits a Gaussian identity-link <generalized additive model>:
$$
Y_i=\alpha+s_1(a_i)+s_2(w_i)+\varepsilon_i,\qquad \varepsilon_i\overset{\rm iid}{\sim}N(0,\sigma^2).
$$
The $s_j$ are centered <penalized regression splines> with cubic regression bases; centering separates them from the intercept. The age curve in the original figure falls to a minimum near age 25, then rises markedly, particularly from about 40 onwards. Its <effective degrees of freedom> are $4.05$, reflecting curvature. The white-cell curve has <effective degrees of freedom> one and is nearly flat with a slight positive slope; the pointwise uncertainty bands are consistent with no substantial effect. These plots display centered partial mean contributions, not numbers of prescriptions by themselves.
A simpler mean model keeps the age <regression spline> and replaces the white-cell smooth by a linear term. A separate issue is that the response is a nonnegative count: a <Poisson regression> with <logarithmic link function> respects that support and positivity of the mean. A reasonable candidate is
``
model1p <- gam(npres ~ s(age, bs="cr") + wbc, family=poisson(link="log"))
gam.check(model1p)
``
If diagnostics show <overdispersion>, one can fit
``
model1nb <- gam(npres ~ s(age, bs="cr") + wbc, family=nb(link="log"))
``
using a <negative binomial regression>. Alternatively, if a Gaussian approximation is adequate, the minimal simplification is `gam(npres ~ s(age, bs="cr") + wbc)`. These are candidates to compare by diagnostics and validation, rather than guaranteed improvements from the partial plots alone. \b[Retain the curved age effect; consider a linear or removable white-cell effect, and assess an appropriate count family.] Refit before interpreting the old curves on a new link scale.
Back to article page