Generalized Linear Models › Maximum Likelihood Estimation
Michael BrenndoerferApril 1, 20252 min read
Machine Learning from ScratchAll chapters Part 4 of 9Regression Models
Generalized Linear Models › Maximum Likelihood EstimationOne section · Sections in this chapter5 / 12 ↓
Sections in this chapter12
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Unlike linear regression, GLMs typically don't have closed-form solutions and require iterative optimization to find the maximum likelihood estimates of the parameters. The likelihood function for a GLM is:
where:
- is the likelihood function (the probability of observing the data given the parameters)
- is the vector of regression coefficients ()
- is the number of observations in the dataset
- is the probability density function (for continuous responses) or probability mass function (for discrete responses) of the chosen distribution for observation
- is the observed response value for observation
- is the vector of predictor values for observation (i.e., where the first element is 1 for the intercept)
- denotes the product over all observations (reflecting the assumption of independent observations)
The log-likelihood is:
where:
- is the log-likelihood function (the logarithm of the likelihood)
- denotes the natural logarithm
- denotes the sum over all observations
- Taking the logarithm converts the product to a sum, which is computationally more stable and prevents numerical underflow when dealing with many small probabilities
The maximum likelihood estimates are found by solving:
where:
- is the maximum likelihood estimate of the coefficient vector (the value that makes the observed data most probable)
- finds the value of that maximizes the log-likelihood function
This is typically done using Iteratively Reweighted Least Squares (IRLS), which is an iterative algorithm that solves a sequence of weighted least squares problems.