A covariance penalty estimates how much fitting to the observed responses reduces training error. The resulting degrees of freedom measure how strongly predictions respond to those responses.
“In-sample” here refers to the input locations, not reuse of the observed responses for scoring. This differs from random-input generalization error, which also averages over a new X0.
Sum and divide by n. Normal errors are not needed. The covariance identity itself also permits unequal response variances; the common-σ2 degrees-of-freedom normalization below uses homoscedasticity.
A model that closely follows each response tends to have a positive covariance penalty. This is why training error typically underestimates fresh-response error on average. Nonnegativity is not a theorem for every arbitrary prediction rule, and the identity above is not an exact correction for all random-input prediction problems.
Equivalently, cyclicity of trace gives tr[(X⊤X)−1X⊤X]=p. With an intercept and d independent predictor columns, p=d+1. If columns are dependent, the projection has df rank(X) and the displayed inverse must be replaced by an appropriate generalized inverse.
Quantity
OLS value
Role
Fitted-model df
p
Complexity of the fitted mean.
Residual df
n−p
Denominator in the usual unbiased error-variance estimate.
These conventions rank candidates identically when they use the same observations and the same variance estimate. A common estimate is the residual mean square from an adequately specified larger model, provided it has residual degrees of freedom. A misspecified larger model can contaminate this estimate.
where q counts estimated likelihood parameters. An equivalent per-observation scaling is AIC/n. Smaller values are preferred among comparable likelihoods fitted to the same response data. The usual AIC penalty is an asymptotic likelihood-based correction under regularity conditions.
Apart from a common additive constant, this is RCp/σ2 when the variance in that score is σ2. Thus the criteria have the same ranking in this setting.
With unknown variance estimated separately by Gaussian maximum likelihood, σMLE2=RSS/n and q=p+1, giving
This is not literally the same formula as the common-variance Cp score. Keep the scaling, variance treatment, and parameter count explicit when comparing formulas.
Covariance penalties are convenient when complexity can be calculated. Cross-validation replaces that calculation with repeated held-out fitting and can be applied to much broader learning procedures.