Covariance formula for prediction optimism (source code)

= Covariance formula for prediction optimism
{title2=$\operatorname{Opt}=\frac2n\sum_i\operatorname{Cov}(Y_i,\widehat Y_i)$}

With fixed covariates and independent new responses having the same marginal distributions as the training responses, expanding squared losses cancels their second moments. Independence makes $\mathbb E(Y_i^{\mathrm{new}}\widehat Y_i)=\mathbb EY_i\mathbb E\widehat Y_i$, yielding the displayed identity. For a fixed <linear smoother> $\widehat Y=HY$ with covariance $\sigma^2I$, it reduces to $2\sigma^2\operatorname{tr}(H)/n$, linking prediction optimism to <effective degrees of freedom>.

// Target: analysis.bigb