Generalized linear model

From HandWiki
(Redirected from Link function)
Short description: Class of statistical models

In statistics, a generalized linear model (GLM) is a flexible generalization of ordinary linear regression. The GLM generalizes linear regression by allowing the linear model to be related to the response variable via a link function and by allowing the magnitude of the variance of each measurement to be a function of its predicted value.

Generalized linear models were formulated by John Nelder and Robert Wedderburn as a way of unifying various other statistical models, including linear regression, logistic regression and Poisson regression.[1] They proposed an iteratively reweighted least squares method for maximum likelihood estimation (MLE) of the model parameters. MLE remains popular and is the default method on many statistical computing packages. Other approaches, including Bayesian regression and least squares fitting to variance stabilized responses, have been developed.

Intuition

Ordinary linear regression predicts the expected value of a given unknown quantity (the response variable, a random variable) as a linear combination of a set of observed values (predictors). This implies that a constant change in a predictor leads to a constant change in the response variable (i.e. a linear-response model). This is appropriate when the response variable can vary, to a good approximation, indefinitely in either direction, or more generally for any quantity that only varies by a relatively small amount compared to the variation in the predictive variables, e.g. human heights.

However, these assumptions are inappropriate for some types of response variables. For example, in cases where the response variable is expected to be always positive and varying over a wide range, constant input changes lead to geometrically (i.e. exponentially) varying, rather than constantly varying, output changes. As an example, suppose a linear prediction model learns from some data (perhaps primarily drawn from large beaches) that a 10 degree temperature decrease would lead to 1,000 fewer people visiting the beach. This model is unlikely to generalize well over differently-sized beaches. More specifically, the problem is that if the model is used to predict the new attendance with a temperature drop of 10 for a beach that regularly receives 50 beachgoers, it would predict an impossible attendance value of −950. Logically, a more realistic model would instead predict a constant rate of increased beach attendance (e.g. an increase of 10 degrees leads to a doubling in beach attendance, and a drop of 10 degrees leads to a halving in attendance). Such a model is termed an exponential-response model (or log-linear model, since the logarithm of the response is predicted to vary linearly).

Similarly, a model that predicts a probability of making a yes/no choice (a Bernoulli variable) is even less suitable as a linear-response model, since probabilities are bounded on both ends (they must be between 0 and 1). Imagine, for example, a model that predicts the likelihood of a given person going to the beach as a function of temperature. A reasonable model might predict, for example, that a change in 10 degrees makes a person two times more or less likely to go to the beach. But what does "twice as likely" mean in terms of a probability? It cannot literally mean to double the probability value (e.g. 50% becomes 100%, 75% becomes 150%, etc.). Rather, it is the odds that are doubling: from 2:1 odds, to 4:1 odds, to 8:1 odds, etc. Such a model is a log-odds or logistic model.

Generalized linear models cover all these situations by allowing for response variables that have arbitrary distributions (rather than simply normal distributions)[clarification needed], and for an arbitrary function of the response variable (the link function) to vary linearly with the predictors (rather than assuming that the response itself must vary linearly). For example, the case above of predicted number of beach attendees would typically be modeled with a Poisson distribution and a log link, while the case of predicted probability of beach attendance would typically be modelled with a Bernoulli distribution (or binomial distribution, depending on exactly how the problem is phrased) and a log-odds (or logit) link function.

Overview

In a generalized linear model (GLM), each outcome Y of the dependent variables is assumed to be generated from a particular distribution in an exponential family, a large class of probability distributions that includes the normal, binomial, Poisson and gamma distributions, among others. The conditional mean μ of the distribution depends on the independent variables X through:

E(𝐘𝐗)=μ=g1(𝐗β),

where E(Y | X) is the expected value of Y conditional on X; Xβ is the linear predictor, a linear combination of unknown parameters β; g is the link function.

In this framework, the variance is typically a function, V, of the mean:

Var(𝐘𝐗)=V(g1(𝐗β)).

It is convenient if V follows from an exponential family of distributions, but it may simply be that the variance is a function of the predicted value.

The unknown parameters, β, are typically estimated with maximum likelihood, maximum quasi-likelihood, or Bayesian techniques.

Model components

The GLM consists of three elements:

1. A particular distribution for modeling Y from among those which are considered exponential families of probability distributions,
2. A linear predictor η=Xβ, and
3. A link function g such that E(YX)=μ=g1(η).

Probability distribution

An overdispersed exponential family of distributions is a generalization of an exponential family and the exponential dispersion model of distributions and includes those families of probability distributions, parameterized by θ and τ, whose density functions f (or probability mass function, for the case of a discrete distribution) can be expressed in the form

fY(𝐲θ,τ)=h(𝐲,τ)exp(𝐛(θ)T𝐓(𝐲)A(θ)d(τ)).

The dispersion parameter, τ, typically is known and is usually related to the variance of the distribution. The functions h(𝐲,τ), 𝐛(θ), 𝐓(𝐲), A(θ), and d(τ) are known. Many common distributions are in this family, including the normal, exponential, gamma, Poisson, Bernoulli, and (for fixed number of trials) binomial, multinomial, and negative binomial.

For scalar 𝐲 and θ (denoted y and θ in this case), this reduces to

fY(yθ,τ)=h(y,τ)exp(b(θ)T(y)A(θ)d(τ)).

θ is related to the mean of the distribution. If 𝐛(θ) is the identity function, then the distribution is said to be in canonical form (or natural form). Note that any distribution can be converted to canonical form by rewriting θ as θ and then applying the transformation θ=𝐛(θ). It is always possible to convert A(θ) in terms of the new parametrization, even if 𝐛(θ) is not a one-to-one function; see comments in the page on exponential families.

If, in addition, 𝐓(𝐲) and 𝐛(θ) are the identity, then θ is called the canonical parameter (or natural parameter) and is related to the mean through

μ=E(𝐲)=θA(θ).

For scalar 𝐲 and θ, this reduces to

μ=E(y)=A(θ).

Under this scenario, the variance of the distribution can be shown to be[2]

Var(𝐲)=θ2A(θ)d(τ).

For scalar 𝐲 and θ, this reduces to

Var(y)=A(θ)d(τ).

Linear predictor

The linear predictor is the quantity which incorporates the information about the independent variables into the model. The symbol η (Greek "eta") denotes a linear predictor. It is related to the expected value of the data through the link function.

η is expressed as linear combinations (thus, "linear") of unknown parameters β. The coefficients of the linear combination are represented as the matrix of independent variables X. η can thus be expressed as

η=𝐗β.

The link function provides the relationship between the linear predictor and the mean of the distribution function. There are many commonly used link functions, and their choice is informed by several considerations. There is always a well-defined canonical link function which is derived from the exponential of the response's density function. However, in some cases it makes sense to try to match the domain of the link function to the range of the distribution function's mean, or use a non-canonical link function for algorithmic purposes, for example Bayesian probit regression.

When using a distribution function with a canonical parameter θ, the canonical link function is the function that expresses θ in terms of μ, i.e. θ=g(μ). For the most common distributions, the mean μ is one of the parameters in the standard form of the distribution's density function, and then g(μ) is the function as defined above that maps the density function into its canonical form. When using the canonical link function, g(μ)=θ=𝐗β, which allows 𝐗T𝐘 to be a sufficient statistic for β.

Following is a table of several exponential-family distributions in common use and the data they are typically used for, along with the canonical link functions and their inverses (sometimes referred to as the mean function, as done here).

Common distributions with typical uses and canonical link functions
Distribution Support of distribution Typical uses Link name Link function, 𝐗β=g(μ) Mean function
Normal real: (,+) Linear-response data Identity 𝐗β=μ μ=𝐗β
Laplace
Exponential real: (0,+) Exponential-response data, scale parameters Negative inverse 𝐗β=μ1 μ=(𝐗β)1
Gamma
Inverse
Gaussian
real: (0,+) Inverse
squared
𝐗β=μ2 μ=(𝐗β)1/2
Poisson integer: 0,1,2, count of occurrences in fixed amount of time/space Log 𝐗β=ln(μ) μ=exp(𝐗β)
Bernoulli integer: {0,1} outcome of single yes/no occurrence Logit 𝐗β=ln(μ1μ) μ=exp(𝐗β)1+exp(𝐗β)=11+exp(𝐗β)
Binomial integer: 0,1,,N count of # of "yes" occurrences out of N yes/no occurrences 𝐗β=ln(μnμ)
Categorical integer: [0,K) outcome of single K-way occurrence 𝐗β=ln(μ1μ)
K-vector of integer: [0,1], where exactly one element in the vector has the value 1
Multinomial K-vector of integer: [0,N] count of occurrences of different types (1, ..., K) out of N total K-way occurrences

In the cases of the exponential and gamma distributions, the domain of the canonical link function is not the same as the permitted range of the mean. In particular, the linear predictor may be positive, which would give an impossible negative mean. When maximizing the likelihood, precautions must be taken to avoid this. An alternative is to use a noncanonical link function.

In the case of the Bernoulli, binomial, categorical and multinomial distributions, the support of the distributions is not the same type of data as the parameter being predicted. In all of these cases, the predicted parameter is one or more probabilities, i.e. real numbers in the range [0,1]. The resulting model is known as logistic regression (or multinomial logistic regression in the case that K-way rather than binary values are being predicted).

For the Bernoulli and binomial distributions, the parameter is a single probability, indicating the likelihood of occurrence of a single event. The Bernoulli still satisfies the basic condition of the generalized linear model in that, even though a single outcome will always be either 0 or 1, the