Tutorials › Statistical Theory III - Theories of Inference, Multivariate Methods, and Contingency Tables › Degrees of Freedom and Bias in Scale Estimation

Quasi-Likelihood and Overdispersion · Tutorial 667 of 972

Degrees of Freedom and Bias in Scale Estimation

Derive the residual-degrees-of-freedom correction for linear models and learn why it is only an approximation for nonlinear Pearson scale estimates.

Advanced 11 min read

What You'll Learn

  • Define the Pearson residual sum of squares and distinguish division by n from division by residual degrees of freedom
  • Derive the exact expected Pearson sum of squares for a full-rank linear mean model with known variance weights
  • Explain when the adjusted estimate is unbiased and when it has a scaled chi-square distribution
  • Calculate both scale estimates for unweighted and weighted linear-model examples
  • Identify finite-sample limitations of the degrees-of-freedom correction in a nonlinear mean model

Why Adjust a Pearson Scale Estimate?

A Pearson scale estimate compares observed variation with the variation predicted by a mean-variance model. In a model with \(n\) observations, the Pearson sum of squares is typically divided by \(n\). But the means in that sum are usually estimated from the same data. Fitting those means absorbs some residual variation, so dividing by \(n\) can underestimate the scale. The familiar correction is to divide by residual degrees of freedom, often \(n-p\) when \(p\) mean parameters have been fitted.

That correction has an exact justification in a linear mean model with a known variance pattern. It is not a universal finite-sample result for nonlinear models: there, fitted means and variance weights may depend on the data in ways that do not yield a simple projection of fixed rank. The distinction matters when interpreting Pearson scale estimates as unbiased estimates rather than as conventional adjustments.

Definition: Suppose \(Y_1,\ldots,Y_n\) have fitted means \(\hat\mu_i\), and the variance model has the form \(\operatorname{Var}(Y_i)=\phi v(\mu_i)\), where \(\phi\) is a scale parameter and \(v(\cdot)\) is a specified variance function. The Pearson sum of squares is $$ Q_P=\sum_{i=1}^n \frac{(Y_i-\hat\mu_i)^2}{v(\hat\mu_i)}. $$ The unadjusted Pearson scale estimate is \(Q_P/n\); a residual-degrees-of-freedom adjustment is \(Q_P/(n-p)\), where \(p\) is the number of fitted mean parameters when that count is appropriate.

For a general mean-variance model, \(\hat\mu_i\) and \(v(\hat\mu_i)\) are estimated quantities. Thus \(Q_P\) is not simply a sum of \(n\) independent, mean-zero, unit-variance terms. The adjustment by \(n-p\) is exact under particular linear-model conditions described next; elsewhere it is a conventional approximation whose performance depends on the model and sample.

Exact Adjustment in a Linear Mean Model

Let \(Y=(Y_1,\ldots,Y_n)^\mathsf{T}\) have mean \(X\beta\), where \(X\) is a fixed \(n\times p\) matrix of rank \(p\). Assume \(\operatorname{Var}(Y)=\phi D\), where \(D=\operatorname{diag}(v_1,\ldots,v_n)\) is known and positive definite. The generalized least-squares estimator fits the mean, and its Pearson sum of squares is the weighted residual sum of squares.

Whitening the observations makes the geometry explicit. Define \(Z=D^{-1/2}Y\) and \(A=D^{-1/2}X\). Then \(E[Z]=A\beta\), \(\operatorname{Cov}(Z)=\phi I_n\), and the least-squares projection onto the columns of \(A\) is \(P=A(A^\mathsf{T}A)^{-1}A^\mathsf{T}\). The residual-maker matrix is \(M=I_n-P\).

Theorem: Under the stated linear-model assumptions, the Pearson sum of squares \(Q_P\) satisfies \(E[Q_P]=\phi(n-p)\). Therefore \(Q_P/(n-p)\) is unbiased for \(\phi\). If, in addition, \(Y\) is multivariate normal, then \(Q_P/\phi\) has a chi-square distribution with \(n-p\) degrees of freedom.

Proof. The whitened residual vector is \(MZ\), so \(Q_P=Z^\mathsf{T}MZ\). Since \(MA=0\), the mean component of \(Z=A\beta+(Z-A\beta)\) is removed, giving \(Q_P=(Z-A\beta)^\mathsf{T}M(Z-A\beta)\). For any random vector \(U\) with mean zero and covariance matrix \(\Sigma\), \(E[U^\mathsf{T}MU]=\operatorname{tr}(M\Sigma)\) when \(M\) is fixed and symmetric. Here \(\Sigma=\phi I_n\), so

$$ E[Q_P]=\phi\operatorname{tr}(M) =\phi\{n-\operatorname{rank}(P)\} =\phi(n-p). $$

The first equality follows by expanding the quadratic form into entries and using \(E[U_iU_j]=\Sigma_{ij}\). The rank of \(P\) is \(p\), so \(M\) is a symmetric idempotent matrix of rank \(n-p\). If \(Z-A\beta\) is multivariate normal with covariance \(\phi I_n\), diagonalizing \(M\) by an orthogonal transformation expresses \(Q_P/\phi\) as the sum of squares of \(n-p\) independent standard normal variables. That is a chi-square distribution with \(n-p\) degrees of freedom. \(\square\)

This result identifies the source of the correction: fitting \(p\) linearly independent mean parameters leaves a residual projection of rank \(n-p\). Normality is not needed for unbiasedness; it is needed for the stated exact chi-square distribution. Also, \(p\) means the rank of the fitted design, not necessarily the number of coefficient labels in a redundant parameterization.

Worked Example: Comparing Two Scale Estimates in Simple Regression

Suppose an unweighted linear regression with an intercept and one slope is fitted to five observations. The predictor values are \(0,1,2,3,4\), and the responses are \(1,3,2,5,4\). Assume the model’s error variance is the scale \(\phi\), so \(v_i=1\).

The predictor mean is \(2\), the response mean is \(3\), and the least-squares slope is \((8)/(10)=0.8\): the numerator is \(\sum_i(x_i-2)(y_i-3)=4+0+0+2+2=8\), and the denominator is \(\sum_i(x_i-2)^2=4+1+0+1+4=10\). The fitted intercept is \(3-0.8(2)=1.4\). Thus the fitted values are \(1.4,2.2,3.0,3.8,4.6\), and the residuals are \(-0.4,0.8,-1.0,1.2,-0.6\).

The Pearson sum of squares is \(Q_P=0.16+0.64+1.00+1.44+0.36=3.60\). There are \(p=2\) fitted coefficients, so \(n-p=3\). The unadjusted estimate is \(3.60/5=0.72\), while the residual-degrees-of-freedom estimate is \(3.60/3=1.20\). Under the linear-model assumptions, the latter is unbiased for \(\phi\); this particular observed value does not have to equal the true scale.

Weighted Residuals and the Role of Model Rank

The same correction applies when observations have different known variance weights. The appropriate Pearson residual is divided by the base variance \(v_i\), and the fitted mean is obtained by generalized least squares. Whitening converts that problem to ordinary least squares, so the exact expected residual sum of squares is still \(\phi(n-p)\), provided the whitened design has rank \(p\).

Worked Example: A Weighted Intercept Model

Consider four independent observations with mean \(\mu\) and variances \(\phi v_i\), where the known base variances are \(v=(1,1,4,4)\). The observed values are \(Y=(1,3,2,6)\). Fit one common mean by weighted least squares.

The fitted mean is the weighted average \(\hat\mu=\{\sum_iY_i/v_i\}/\{\sum_i1/v_i\}=(1+3+0.5+1.5)/(1+1+0.25+0.25)=6/2.5=2.4\). The residuals are \(-1.4,0.6,-0.4,3.6\). Therefore \(Q_P=1.96+0.36+0.16/4+12.96/4=1.96+0.36+0.04+3.24=5.60\).

There is one fitted mean parameter, so the residual degrees of freedom are \(4-1=3\). The unadjusted scale estimate is \(5.60/4=1.40\), and the adjusted estimate is \(5.60/3\approx1.867\). With the specified linear mean and known weights, the adjusted estimate is unbiased for \(\phi\); the unadjusted one has expectation \(3\phi/4\).

The last expectation follows directly from the theorem: \(E[Q_P/n]=\phi(n-p)/n\), whereas \(E[Q_P/(n-p)]=\phi\). The unadjusted estimate is downward-biased in this setting when \(p>0\). The correction is not a claim that every observed adjusted estimate is closer to \(\phi\), nor does it guarantee that an estimate in a nonlinear model is unbiased.

Why the Adjustment Is Limited in Nonlinear Models

In a nonlinear mean model, fitted values generally do not arise by projecting the data onto a fixed \(p\)-dimensional linear subspace. The fitting map depends on the observations, and the Pearson weights may also change with the fitted means. Consequently, the residual sum of squares need not be a fixed quadratic form with a residual-maker matrix of trace \(n-p\). Dividing by \(n-p\) remains common, but the exact linear-model proof does not establish its unbiasedness.

A simple Bernoulli example shows why caution is needed. Let \(Y_1,\ldots,Y_4\) be independent Bernoulli observations with common success probability \(p\), and fit a logistic intercept \(\alpha\), with \(p=\exp(\alpha)/\{1+\exp(\alpha)\}\). For a sample with \(k\) successes and \(0<k<4\), the fitted probability is \(\hat p=k/4\), and the Pearson sum of squares is

$$ Q_P=\frac{k(1-\hat p)^2+(4-k)\hat p^2}{\hat p(1-\hat p)}=4. $$

To verify the equality, substitute \(k=4\hat p\): the numerator becomes \(4\hat p(1-\hat p)^2+4(1-\hat p)\hat p^2=4\hat p(1-\hat p)\), which cancels the denominator. For \(k=1\), for example, the fitted probability is \(1/4\). The one success contributes \((3/4)^2/\{(1/4)(3/4)\}=3\); each of the three failures contributes \((1/4)^2/\{(1/4)(3/4)\}=1/3\). Hence \(Q_P=3+3(1/3)=4\). The adjusted estimate with \(n-p=3\) is \(4/3\), although the Bernoulli variance corresponds to scale \(\phi=1\).

Important limitation: In this Bernoulli example, \(Q_P/(n-p)=4/3\) for every interior sample, rather than equaling the true scale. If all four outcomes are identical, the fitted probability is 0 or 1 and the Pearson denominator is zero, so the statistic is undefined. This is a finite-sample illustration, not a claim that the adjustment is always biased upward in nonlinear models. The direction and size of finite-sample bias depend on the model and data.

In regular nonlinear models, \(n-p\) is often used as a practical residual-degrees-of-freedom adjustment, and large-sample arguments may support it as an approximation. But nonlinear curvature, leverage, estimated variance weights, and boundary behavior can all affect the finite-sample expectation. A residual degrees-of-freedom count is therefore a useful convention, not a substitute for checking the assumptions behind an exact result.

Common Mistake: Treating \(n-p\) as a Universal Identity

  • Incorrect reasoning: “There are \(p\) estimated parameters, so the Pearson sum of squares always has expectation \(\phi(n-p)\).”
  • Correction: The exact result above depends on a fixed linear mean space, known positive variance weights, and a full-rank design. In a nonlinear model, the fitting and weighting operations need not produce the fixed projection used in the proof.
  • Another mistake: “The adjusted estimate must be closer to the true scale in this sample.” Unbiasedness concerns an average over repeated samples, not the accuracy of every realized estimate.
Key takeaway: For a full-rank linear mean model with known variance weights, \(E[Q_P]=\phi(n-p)\), so \(Q_P/(n-p)\) is exactly unbiased. In nonlinear models, the same divisor is a common adjustment, but its finite-sample justification must not be assumed.

Check Your Understanding

Use the assumptions as carefully as the arithmetic.

  1. In a linear model with \(n=20\) observations and a rank-4 design, what is the residual degrees of freedom?
  2. Why is normality unnecessary for the unbiasedness of \(Q_P/(n-p)\), but needed for the stated chi-square distribution?
  3. For the weighted example, explain why the fitted mean is a weighted average and why the variance weights enter the Pearson sum of squares as divisors.
  4. In the Bernoulli example, why is the Pearson statistic undefined when all observations have the same outcome?
  5. State one reason that dividing a nonlinear-model Pearson sum of squares by \(n-p\) need not give an exactly unbiased estimate.
Clinical Biostats