From Gaussian Precision Weights to Least Squares
In Gaussian regression, observations need not contribute equally to the fit. If an observation has a larger precision weight, its variance is smaller under the model, and a given residual contributes more to the log-likelihood. This tutorial makes that connection precise: differentiating the Gaussian log-likelihood gives the weighted normal equations, and solving those equations minimizes the weighted residual sum of squares.
Let \(Y_1,\ldots,Y_n\) be conditionally independent observations, with observed values \(y_1,\ldots,y_n\). Let \(X\) be the \(n\times p\) design matrix, with row \(i\) equal to \(x_i^\mathsf{T}\), and let \(\beta\in\mathbb{R}^p\) be the coefficient vector. Assume the identity-link Gaussian model and positive fixed precision weights \(w_i\):
Here \(\phi\) is the common dispersion, and \(w_i\) multiplies the precision \(1/\phi\). Define \(W=\operatorname{diag}(w_1,\ldots,w_n)\) and the weighted residual sum of squares
Deriving the Score and the Normal Equations
For fixed \(\phi\) and weights, the independent Gaussian likelihood is the product of the observation densities. Taking its logarithm gives
The first two terms do not depend on \(\beta\). Differentiating the final term with respect to the vector \(\beta\), and writing \(r=y-X\beta\), yields the score
The likelihood score equation \(U(\beta)=0\) is therefore equivalent to \(X^\mathsf{T}W(y-X\beta)=0\), since \(\phi>0\). Rearranging gives the weighted normal equations. The derivation does not require estimating \(\phi\): for any fixed positive \(\phi\), the factor \(1/\phi\) does not change the equation for \(\beta\).
Worked Example: A Weighted Intercept
Suppose three independent observations have means equal to a common intercept \(\beta\), with observed values \(2,4,10\) and precision weights \(1,2,1\), respectively. Find the score estimate.
For an intercept-only model, \(X\) is a column of ones. The normal equation reduces to \(\sum_i w_i(y_i-\beta)=0\). Equivalently,
Check the score directly: the fitted residuals are \(2-5=-3\), \(4-5=-1\), and \(10-5=5\). Their weighted sum is
The weighted residual sum of squares at this estimate is \(1(9)+2(1)+1(25)=36\). The weight of 2 makes the middle observation count twice as much as an observation with weight 1 in the score and in \(Q\).
Worked Example: A Weighted Line with an Intercept
Consider observations \((x_i,y_i)=(0,1),(1,2),(2,2)\), with weights \(1,2,1\). Fit the mean \(\beta_0+\beta_1x_i\). The design matrix has rows \((1,x_i)\). The entries of \(X^\mathsf{T}WX\) are the weighted sums of \(1,x_i,x_i^2\):
The equations are \(4\beta_0+4\beta_1=7\) and \(4\beta_0+6\beta_1=8\). Subtracting the first equation from the second gives \(2\beta_1=1\), so \(\hat{\beta}_1=0.5\), and then \(4\hat{\beta}_0+2=7\), giving \(\hat{\beta}_0=1.25\).
The fitted values are \(1.25,1.75,2.25\), and the residuals are \(-0.25,0.25,-0.25\). The two score components are proportional to the weighted residual sum and the weighted \(x\)-times-residual sum:
The weighted residual sum of squares is \(1(0.25^2)+2(0.25^2)+1(0.25^2)=0.25\), consistent with the score equations.
Why the Equations Minimize Weighted Residual Sum of Squares
A zero score gives a stationary point, but a stationary point need not minimize every possible objective. For this Gaussian model, the quadratic form of \(Q\) allows a direct global argument.
Proof. Put \(\delta=\beta-\hat{\beta}\). Since \(y-X\beta=(y-X\hat{\beta})-X\delta\), expansion gives
The middle term is zero by the normal equations. The remaining difference is
This proves global minimization. If \(X\) has full column rank and \(\delta\ne0\), then \(X\delta\ne0\). Because every \(w_i>0\), the displayed sum is strictly positive. Hence no other \(\beta\) attains the same minimum. Also, for any nonzero vector \(v\), \(v^\mathsf{T}X^\mathsf{T}WXv=\sum_i w_i(x_i^\mathsf{T}v)^2>0\); thus \(X^\mathsf{T}WX\) is invertible, and solving the normal equations gives the stated formula. \(\square\)
The rank condition matters. If columns of \(X\) are linearly dependent, different coefficient vectors can give the same fitted means and the same value of \(Q\). The normal equations still describe the minimizers, but the coefficient vector need not be unique. This is why the inverse formula must not be used without checking full column rank.
Worked Example: A Weighted Regression Through the Origin
Suppose a model has no intercept, so its mean is \(\beta x_i\). The observations are \((x_i,y_i)=(1,2),(2,3),(3,5)\), with weights \(1,3,2\). There is one coefficient, and the normal equation is
The two sums are
Therefore \(\hat{\beta}=50/31\). The weighted score is proportional to \(50-31\beta\), which is zero at this estimate. The fitted values are \(50/31,100/31,150/31\), so the residuals are \(12/31,-7/31,5/31\). Their weighted residual sum of squares is
Since the design column is nonzero, it has full column rank in this one-coefficient model. The theorem therefore guarantees that this estimate is the unique global minimizer.
What the Result Does—and Does Not—Say
The derivation gives two equivalent ways to find the Gaussian coefficient estimate: set the coefficient score to zero, or minimize \(Q(\beta)\). The equivalence follows because the log-likelihood depends on \(\beta\) through \(-Q(\beta)/(2\phi)\), with \(\phi>0\). It is not necessary to expand the likelihood further to locate the coefficient estimate.
A common mistake is to assume that a larger precision weight divides the residual's contribution. Under the model used here, the variance is \(\phi/w_i\), and the likelihood contains \(w_i(y_i-x_i^\mathsf{T}\beta)^2\), not that residual squared divided by \(w_i\). For example, replacing \(W\) by \(W^{-1}\) would change the normal equations and would correspond to a different objective. Always read the variance specification first: the weights in this derivation multiply the residual squares because they are precision weights.
Another error is to report \((X^\mathsf{T}WX)^{-1}X^\mathsf{T}Wy\) when \(X^\mathsf{T}WX\) is singular. The normal equations remain the right condition, but an ordinary inverse then does not exist, and a unique coefficient vector is not guaranteed. For a full-column-rank design, positive weights ensure the inverse exists, as shown in the proof.
Check Your Understanding
Use the model and arguments developed above to answer the following.
- For independent Gaussian responses with variances \(\phi/w_i\), write the coefficient score in matrix form and state the resulting normal equations.
- In an intercept-only model, show how the normal equation expresses the estimate as a weighted average of the observed responses.
- Why does the quadratic expansion of \(Q(\beta)\) establish global minimization rather than only stationarity?
- What condition on \(X\) makes the coefficient estimate unique, and why do strictly positive weights matter?
- If a stated variance is \(\phi/w_i\), explain why the residual sum of squares uses \(w_i\), rather than \(1/w_i\).