Solution (source code)

= Solution

Let $\widehat\beta=(X^TX)^{-1}X^TY$, $H=X(X^TX)^{-1}X^T$, $\widehat y_i=x_i^T\widehat\beta$, and $e_i=y_i-\widehat y_i$. The horizontal axis of the <residual-versus-fitted plot> is $\widehat y_i$, the <fitted values>, and the vertical axis is $e_i$, the <regression residual>, in millimetres. Under the <normal linear model>, $\operatorname{Var}(e_i)=\sigma^2(1-h_{ii})$, where $h_{ii}$ is the <regression leverage>.

In the <quantile-quantile plot>, the vertical values are the ordered <standardized regression residuals>
$$
r_i=\frac{e_i}{s\sqrt{1-h_{ii}}},
$$
and the horizontal values are corresponding theoretical <quantiles> $\Phi^{-1}(p_k)$ of the standard <normal distribution>, with plotting positions such as $p_k=(k-1/2)/n$. The exact plotting-position convention has little practical effect here. Under Gaussian errors these points should approximately follow a straight line; they are not independent because fitting induces residual correlations.

\b[The main visible concern is curvature in the conditional mean.] The red smooth in the <residual-versus-fitted plot> descends from positive residuals at low fitted values, becomes negative in the middle, and rises again at high fitted values. This suggests the strictly linear time effects may be inadequate. There is no clear monotone widening of the residual scatter, so strong <heteroscedasticity> is not apparent. The <quantile-quantile plot> has modest tail deviations and a few labelled observations, but does not show a dramatic departure from <normal distribution>[normality]. These plots cannot establish <independence> across days or laboratories; check residuals against day, laboratory, and sampling order as well. A large <coefficient of determination> does not remove the visible mean-model concern.