= Solution
The residual smooth rises from negative values, arches above zero, then falls at high fitted values. This suggests a nonlinear altitude effect on the log mean. Since the fitted log mean in the linear model increases with altitude, the horizontal fitted-value axis is also an increasing rescaling of altitude. A <generalized additive model> with <Quasi-Poisson regression> is therefore a reasonable candidate:
$$
\log\mu_i=\alpha+f(a_i),\qquad
\operatorname{Var}(Y_i)=\phi\mu_i,\qquad\sum_i f(a_i)=0.
$$
The centering constraint identifies the intercept. Here `bs="cr"` uses a penalized <cubic regression spline>. The plotted count residuals are <deviance residuals>, with the Q-Q panel using leverage-standardized versions. The <quantile-quantile plot> also shows tail discrepancies, but <normal distribution>[normality] of count residuals is not a distributional assumption of this model: its main requirements are an adequate mean, variance relation, and <independence>. Investigate the labelled islands and possible excess variation as well.
The estimated smooth in the second plot increases fairly rapidly at low altitude, flattens around altitude 20 to 25, and is nearly level at the upper end. The pointwise bands widen where there are fewer observations. \b[A penalized spline can describe a rise followed by a plateau without forcing a global parabola.] A quadratic log mean has slope $\beta_1+2\beta_2a$, so negative curvature eventually forces a decline and its curvature is constant everywhere. A <cubic regression spline> allows different curvature over different ranges, with a penalty controlling unnecessary wiggles and natural linear tails outside its boundary knots. The displayed smooth supports this greater flexibility, but it is not by itself a formal rejection of every quadratic model. Select complexity and compare predictive performance using <cross-validation>, then reassess residuals and the <Pearson dispersion estimator>.
Back to article page