Generalized Linear Models Notes
Chapter 9: Generalized Linear Models
Section 1: Components of the Model
Definition: A generalized linear model formally describes the relationship between a response variable and a collection of predictors.
It specifies three components:
- Random Component:
- Specifies the response variable and its distribution conditional on predictors .
- Systematic Component:
- Specifies the predictors in the linear predictor .
- Link Function:
- Specifies the relationship between the systematic component and the expected value of the random component.
- Link functions are chosen based on the probability distribution of the random component.
- 'Natural' link functions are called canonical link functions.
- Random Component:
Canonical Link Functions:
- Normal: Identity link;
- Poisson: Log link;
- Exponential/Gamma: Inverse link;
- Binomial: Logit link;
- Probit: Normal Quantile;
Example: Normal Error Regression Model
- Uses the identity link function:
Example: Binomial Distribution
- Response follows a binomial distribution with parameters n and
Example: Poisson Distribution
- Response follows a Poisson distribution with parameter
Section 2: Maximum Likelihood Estimators
Definition: Given a random sample with density functions , that depends on a parameter (possibly a vector) and predictor , the likelihood function is:
The log-likelihood function is:
- Likelihood function of a random sample is a product of density functions.
- Log-likelihood function of a random sample is the sum of the logs of density functions.
- The response and predictors are fixed (observed), and the parameters are the unknowns to be estimated.
Definition: The maximum likelihood estimate (MLE) of a parameter is the value that maximizes the observed data's likelihood.
- could represent multiple parameters (e.g., mean and variance).
- MLE is usually computed using the log-likelihood function (since log is increasing, both maximize at the same place).
- Theoretically, try all possible values for until you find the one that maximizes the (log)-likelihood function, subject to any constraints.
Example: Bernoulli Distribution
- A random sample of size three is taken from a Bernoulli distribution with unknown proportion of successes .
- Observed values: one success and two failures.
- Density function: , where y = 0, 1 and
- Likelihood function:
- Log-likelihood function:
Section 3: Likelihood Ratio Test
Suppose and are two models with a restricted version of :
(restricted)
(full)
Let be the maximum log-likelihood of a model M.
Definition: The likelihood ratio test statistic is given by .
- If n >>> 0, then the likelihood ratio test statistic has an approximate distribution with degrees of freedom.
- is the number of extra parameters or the difference in the number of parameters.
Definition: The likelihood ratio test of
- (restricted)
- : at least one is not equal to 0 (full)
- Rejects the null hypothesis if:
- The test statistic is greater than the appropriate critical value,
- p-value = P(\chi^2_k \geq LRT) < \alpha
Example: Bernoulli Distribution (continued)
- Maximum log-likelihood function:
Section 4: Binary Data: Logistic Regression
Using a linear regression model with a binary response leads to fitting a line with an infinite range to the binary response.
Logistic Regression fits a curve that will estimate the probability of a response at various predictor values.
Example: Challenger Space Shuttle Disaster
- On January 28, 1986, the Challenger space shuttle broke apart 73 seconds into the flight, killing all seven crew members.
- Investigation focused on O-rings, and damage to these O-rings may be related to the ambient temperature during the launch.
Definition: Suppose is a Bernoulli random variable with success probability . The odds of success are given by .
Definition: A random variable has a Binomial distribution with parameters (number of independent trials) and success probability if its probability mass function is:
- , where and 0 < \pi < 1
R Code Examples:
- See transcript for R code examples applying logistic regression to the Challenger disaster and Donner party datasets, including:
- Fitting generalized linear models using
glm()with `family = binomial(link =
- Fitting generalized linear models using
- See transcript for R code examples applying logistic regression to the Challenger disaster and Donner party datasets, including: