Hello! Welcome back to our course on Generalized Linear Models (GLMs).
In the last lesson, we learned how to find the score function, which is the derivative of the log-likelihood. To find the Maximum Likelihood Estimates (MLEs) for our model parameters (), we need to solve the score equation .
For simple linear regression, this equation has a neat, closed-form solution. However, for most GLMs, like logistic or Poisson regression, the equations are too complex to solve directly. This is where numerical optimization algorithms come into play.
Today, we'll explore the most common and important algorithm used to fit GLMs: Fisher Scoring. You'll learn how it works, what its steps are, and see that it's equivalent to a clever procedure called Iteratively Reweighted Least Squares (IRWLS). Understanding this process is key to grasping how statistical software actually calculates the model estimates you see in its output.
From Newton-Raphson to Fisher Scoring
Most numerical optimization methods are based on the Newton-Raphson algorithm. You might remember it from calculus as a method for finding the roots of a function. We want to find the roots of the score function, .
The Newton-Raphson update step to find the maximum of a function is:
Where:
- is the vector of parameter estimates at iteration .
- is the score vector (first derivative of log-likelihood) evaluated at .
- is the Hessian matrix (second derivative of log-likelihood) evaluated at .
The Hessian matrix, , measures the curvature of the log-likelihood function. While Newton-Raphson is very powerful, calculating the full Hessian matrix can be computationally difficult and unstable.
The Fisher Scoring Algorithm
The Fisher Scoring algorithm is a modification of Newton-Raphson. Instead of using the observed Hessian matrix, , it uses its expected value, which is the negative of the Fisher Information Matrix, .
Key Idea: Replace with .
The Fisher Scoring update rule then becomes:
This small change has two big advantages:
- Simpler Calculations: The Fisher Information matrix often has a simpler form than the Hessian.
- Guaranteed Direction: The information matrix, , is always positive semi-definite, which ensures that each step moves towards the maximum of the likelihood function.
The following video provides a great visual and mathematical overview of the Newton-Raphson method and its evolution into Fisher Scoring.
GLM - 10 - Numerical Solution (Newton-Raphson, Fisher Scoring, IRLS)
This video walks through the derivation of the Newton-Raphson method for GLMs and then shows how it is adapted into the Fisher Scoring algorithm. Pay close attention from the 3:49 mark, where the Fisher Information matrix is introduced.
Watch from the beginning until 10:55. The first few minutes cover the Newton-Raphson method. The key part for us starts at 3:49, where the video explains the Hessian matrix and then introduces the Fisher Information matrix as its expected value. Note how this simplifies the calculations.
As you saw in the video, a key result is that for the exponential family of distributions, the expected value of the second-order derivative term simplifies nicely. The term involving the data, , has an expectation of zero, which makes the calculation of the Fisher Information matrix much easier than the observed Hessian.
From Fisher Scoring to Iteratively Reweighted Least Squares (IRWLS)
Now, here's where the magic happens. The Fisher Scoring update rule can be rearranged to look exactly like the solution to a weighted least squares (WLS) problem. This gives us a practical, step-by-step algorithm to implement.
Let's look at the components again:
- The score function (in matrix form):
- The Fisher Information matrix:
Here, is a diagonal matrix of weights, and is a diagonal matrix related to the derivative of the link function.
Substituting these into the Fisher Scoring update rule:
This equation can be cleverly rearranged to:
Where is a new, constructed vector called the working response or adjusted dependent variable:
...and the weights are:
Does this look familiar? The equation for is precisely the solution to a weighted least squares problem, where you are regressing the working response on the predictors using weights .
Because we have to re-calculate the weights and the working response at each step (since they depend on ), the process is called Iteratively Reweighted Least Squares (IRWLS).
The following resources provide a more formal, step-by-step definition of the algorithm.
[PDF] Generalized linear models
This document lays out the mathematical formulas for the Fisher's scoring method and the IRWLS algorithm in a clear, step-by-step format. It will help solidify your understanding of the process.
Please read slides 8-11. Focus on the formal steps of the 'Fisher's scoring method' (slide 9), how it's applied to GLMs (slide 10), and how this leads to the 'Iteratively reweighted least squares (IRWLS) algorithm' (slide 11).
The IRWLS Algorithm in Practice
So, how does this work in a step-by-step fashion?

The IRWLS Algorithm:
-
Initialization (k=0):
- Choose an initial estimate for the parameters, . A good starting point is often obtained by fitting a standard linear model of on .
- From , calculate initial values for the linear predictor and the mean .
-
Iteration (k):
- Calculate the working response : This can be seen as the current linear predictor adjusted by the "residual" scaled by the rate of change of the link function.
- Calculate the weights : Notice that observations with higher variance (larger ) will receive less weight in the estimation.
-
Update:
- Solve the weighted least squares problem to get the new parameter estimates :
-
Check for Convergence:
- Repeat steps 2 and 3 until the change in the log-likelihood or the parameter estimates between iterations is very small (below a set tolerance).
To see how this works for specific models, review the examples for logistic and Poisson regression in the resource below.
[PDF] Generalized linear models
Let's reinforce the IRWLS steps with concrete examples for logistic and Poisson regression. This will help you see how the general formulas for the working response and weights are applied to specific distributions.
Review the examples for logistic regression (slide 12-13) and Poisson regression (slide 14-15). Pay attention to how the specific forms of g'(μ) and V(μ) for each distribution are substituted into the general formulas for the working response (Z) and weights (W).
Conclusion
In this lesson, we demystified the process of fitting a Generalized Linear Model. We saw that because the score equations are often non-linear, we need iterative methods to find the maximum likelihood estimates.
Key takeaways:
- Fisher Scoring is a common algorithm for this, which approximates the complex Hessian matrix with the more stable Fisher Information matrix.
- For GLMs, the Fisher Scoring algorithm is equivalent to Iteratively Reweighted Least Squares (IRWLS).
- The IRWLS algorithm involves creating a "working response" variable and "weights" at each step, and then solving a simple weighted least squares problem to update the parameter estimates until they converge.
Now that we understand how the model parameters are estimated, our next step is to learn how to evaluate the model's fit and perform hypothesis tests on the coefficients. We'll cover topics like deviance, and the Likelihood Ratio, Wald, and Score tests.