Having introduced GLMs for binary and count data, we now turn our attention to details such as likelihood equations and methods for fitting them. The remainder of this chapter is somewhat technical, providing general results applying to most modeling methods presented in subsequent chapters.
Ž .
See McCullagh and Nelder 1989 for further details.
MOMENTS AND LIKELIHOOD FOR GENERALIZED LINEAR MODELS 133 It is helpful to extend the notation for a GLM so that it can handle many distributions that have a second parameter. The random component of the
Ž .
GLM specifies that the N observations y1, . . . , yN on Y are independent, with probability mass or density function for yi of form
f yŽ i;i,.sexp
yi i ybŽi. raŽ.qc yŽ i,.4
. Ž4.14. This is called the exponential dispersion family and is called the dispersionŽ .
parameter Jorgensen 1987 . The parameterⲐ i is the natural parameter.
Ž . Ž .
When is known, 4.14 simplifies to the form 4.1 for the natural exponential family, which is
f yŽ i;i.saŽi.b yŽ i.exp y Qi Ži. .
Ž . Ž . Ž . Ž . w Ž . Ž .x
We identify Q here with ra in 4.14 , a with expyb ra in Ž4.14 , and. b yŽ .with expwc y,Ž .xin 4.14 . The more general formula 4.14Ž . Ž . is not needed for one-parameter families such as the binomial and Poisson.
Ž . Ž .
Usually, a has form a sri for a known weight i. For instance, when yi is a mean of ni independent readings, such as a sample proportion
Ž .
for ni Bernoulli trials, isni Section 4.4.2 .
4.4.1 Mean and Variance Functions for the Random Component
Ž . Ž . Ž .
General expressions for E Yi and var Yi use terms in 4.14 . Let Lis
Ž .
logf yi;i, denote the contribution of yi to the log likelihood; that is, the
Ž .
log-likelihood function is LsÝiLi. Then, from 4.14 ,
Lis yi i ybŽi. raŽ.qc yŽ i,. . Ž4.15. Therefore,
X 2 2 Y
⭸Lir⭸is yiybŽi. raŽ., ⭸ Lir⭸i s yb Ži.raŽ.,
XŽ . YŽ . Ž .
where b i and b i denote the first two derivatives of b⭈ evaluated at i. We now apply the general likelihood results
2
⭸L ⭸2L ⭸L
E
ž
⭸/
s0 and yEž
⭸2/
sEž
⭸/
,which hold under regularity conditions satisfied by the exponential family ŽCox and Hinkley 1974, Sec. 4.8 . From the first formula applied with a single.
w XŽ .x Ž .
observation, E Yiyb i ra s0, or
isE YŽ i.sbXŽi.. Ž4.16.
INTRODUCTION TO GENERALIZED LINEAR MODELS
134
From the second formula,
2 2
Y X
b Ži.raŽ.sE
Ž
YiybŽi..
raŽ. svarŽYi.r aŽ. , so thatvarŽYi.sbYŽi. Ža .. Ž4.17.
Ž . Ž .
In summary, the function b⭈ in 4.14 determines moments of Yi. 4.4.2 Mean and Variance Functions for Poisson and Binomial
We illustrate the mean and variance expressions for Poisson and binomial distributions. When Yi is Poisson,
eyiiyi
f yŽ i;i.s sexpŽyilogiyiylog yi!. yi!
sexp yi i yexpŽi.ylogyi! ,
Ž . Ž .
where islog i. This has exponential dispersion form 4.14 with b i s
Ž . Ž . Ž .
exp i, a s1, and c yi, s ylog yi!. The natural parameter is is
Ž . Ž .
logi. From 4.16 and 4.17 ,
E YŽ i.sbXŽi.sexpŽi.si, varŽYi.sbYŽi.sexpŽi.si.
Ž .
Next, suppose that n Yi i has a bin ni,i distribution; that is, here yi is
Ž . Ž .
the sample proportion rather than number of successes, so E Yi is indepen-w Ž .x Ž . w Ž .x dent of ni. Let islogir 1yi . Then,isexp ir1qexp i and
Ž . w Ž .x Ž .
log 1yi s ylog 1qexp i . Extending 4.3 , one can show that ni n yi i niyn yi i
f yŽ i;i,ni.s
ž /
n yi i i Ž1yi.yi i ylog 1qexpŽi. ni
sexp 1rni qlog
ž /
n yi i . Ž4.18.Ž . Ž . w Ž .x
This has exponential dispersion form 4.14 with b i slog 1qexp i ,
ni
Ž . Ž .
a s1rni, and c yi, slog
ž /
n yi i . The natural parameter is the logit, w Ž .x Ž . Ž .islogir 1yi . From 4.16 and 4.17 ,
E YŽ i.sbXŽi.sexpŽi.r 1qexpŽi. si,
Y 2
varŽYi.sb Ži. Ža .sexpŽi.r
½
1qexpŽi. ni5
siŽ1yi.rni.MOMENTS AND LIKELIHOOD FOR GENERALIZED LINEAR MODELS 135 4.4.3 Systematic Component and Link Function
Ž .
Let xi1, . . . ,xi p denote values of explanatory variables for observation i.
4
The systematic component of a GLM relates parameters i to these variables using a linear predictor
is
Ý
jxi j, is1, . . . ,N.j
In matrix form,
sX,
Ž .X Ž .X
where s 1, . . . ,N , s 1, . . . ,p are column vectors of model parameters, andXis the N=pmatrix of values of the explanatory variables for the Nsubjects. In ordinary linear models,Xis called the design matrix. It need not refer to an experimental design, however, and the GLM literature calls it the model matrix.
Ž . Ž .
The GLM linksi toisE Yi by a link function g ⭈. Thus, i relates to the explanatory variables by
isgŽi.s
Ý
jxi j, is1, . . . ,N.j
Ž . Ž .
The link function g for which g i si in 4.14 is the canonical link. For it, the direct relationship
is
Ý
jxi j joccurs between the natural parameter and the linear predictor.
XŽ .
Since isb i , the natural parameter is the function of the mean,
Ž X.y1Ž . Ž X.y1Ž . X
is b i, where b ⭈ denotes the inverse function to b. Thus, the
X Ž .
canonical link is the inverse of b. In the Poisson case, for instance, b i s
Ž . XŽ . Ž . Ž X.y1Ž .
exp i, so b i sexp i si. Thus, b ⭈ is the inverse of the
expo-Ž .
nential function, which is the log function i.e., islogi . The canonical link is the log link.
4.4.4 Likelihood Equations for a GLM
Ž .
For N independent observations, from 4.15 the log likelihood is yi i ybŽi.
LŽ.s
Ý
LisÝ
log f yŽ i;i,.sÝ
qÝ
c yŽ i,.. aŽ.i i i i
4.19
Ž .
Ž .
The notation L reflects the dependence of on the model parameters .
INTRODUCTION TO GENERALIZED LINEAR MODELS
136
The likelihood equations are
⭸LŽ.r⭸js
Ý
⭸Lir⭸js0i
Ž .
for all j. To differentiate the log likelihood 4.19 , we use the chain rule,
⭸Li ⭸Li ⭸ ⭸ ⭸i i i
s . Ž4.20.
⭸j ⭸ ⭸ ⭸ ⭸i i i j
w XŽ .x Ž . XŽ . Ž . Since ⭸Lir⭸is yiyb i ra , and since isb i and var Yi s
YŽ . Ž . Ž . Ž .
b i a from 4.16 and 4.17 ,
⭸Lir⭸isŽyiyi.raŽ., ⭸ir⭸isbYŽi.svarŽYi.raŽ.. Also, sinceisÝjjxi j,
⭸ir⭸jsxi j. Ž .
Finally, sinceisg i,⭸ir⭸idepends on the link function for the model.
Ž .
In summary, substituting into 4.20 gives us
⭸Li yiyi aŽ. ⭸i Žyiyi.xi j ⭸i
s xi js . Ž4.21.
⭸j aŽ. varŽYi. ⭸i varŽYi. ⭸i The likelihood equations are
N Žyiyi.xi j ⭸i
s0, js1, . . . ,p. Ž4.22.
Ý
varŽYi. ⭸iis1
Although does not appear in these equations, it is there implicitly through
y1Ž .
i, since isg Ýjjxi j . Different link functions yield different sets of equations.
Ž .
Interestingly, the likelihood equations 4.22 depend on the distribution of Ž .
Yi only through i and var Yi . The variance itself depends on the mean through a particular functional form
varŽYi.s ®Ži.
Ž . Ž . Ž .
for some function ®, such as ® i si for the Poisson, ® i si1yi
Ž . 2 Ž .
for the Bernoulli, and ® i s i.e., constant for the normal. When Yi has distribution in the natural exponential family, the relationship between
Ž .
the mean and the variance characterizes the distribution Jorgensen 1987 .Ⲑ For instance, if Yi has distribution in the natural exponential family and if
Ž .
® i si, then necessarily Yi has the Poisson distribution.
MOMENTS AND LIKELIHOOD FOR GENERALIZED LINEAR MODELS 137 4.4.5 Likelihood Equations for Binomial GLMs
Ž .
Using notation from Section 4.4.2, suppose that n Yi i has a bin ni,i
distribution. Then yi is a sample proportion of successes for ni trials. The
Ž .
binomial GLM 4.8 for a single predictor extends with several predictors to
is⌽
ž Ý
j jxi j/
, Ž4.23.where ⌽ is the standard cdf of some class of continuous distributions. Since Ž .
isis⌽i with isÝjjxi j,
⭸ir⭸is Ž i.s
ž Ý
j jxi j/
,Ž . Ž . Ž
where u s⭸ ⌽ ur⭸u i.e., the probability density function corresponding
. Ž . Ž . Ž .
to the cdf ⌽ . Since var Yi si1yirni, the likelihood equations 4.22 simplify to
niŽyiyi.xi j
 x s0, Ž4.24.
Ý
i iŽ1yi.ž Ý
j j i j/
Ž . y1
whereis⌽ Ýjjxi j . These depend on the link function ⌽ through the derivative of its inverse.
w Ž .x w Ž .x For the logit link,islogir1yi , so ⭸ir⭸is1ri1yi and
Ž . Ž .
⭸ir⭸is⭸ir⭸isi 1yi . Then the likelihood equations 4.22 and Ž4.24 simplify to.
nŽy y .x s0, Ž4.25.
Ý
i i i i j iŽ .
wherei satisfies 4.23 with ⌽ the standard logistic cdf.
4.4.6 Asymptotic Covariance Matrix of Model Parameter Estimators The likelihood function for the GLM also determines the asymptotic covari-ance matrix of the ML estimator ˆ. This matrix is the inverse of the
w 2 Ž . x
information matrix
IIIII
, which has elements Ey⭸ L  r⭸ ⭸h j. To find this, for the contribution Lito the log likelihood we use the helpful result⭸2Li ⭸Li ⭸Li E
ž
⭸ ⭸h j/
s yEž
⭸h/ ž
⭸j/
,INTRODUCTION TO GENERALIZED LINEAR MODELS
138
Ž .
which holds for exponential families Cox and Hinkley 1974, Sec. 4.8 . Thus,
⭸2Li ŽYiyi.xi h ⭸i ŽYiyi.xi j ⭸i
E
ž
⭸ ⭸h j/
s yE varŽYi. ⭸i varŽYi. ⭸i from 4.21Ž . yx xi h i j ⭸i 2s varŽYi.
ž
⭸i/
. Ž .Since L sÝi Li,
2 N 2
⭸ LŽ. x xi h i j ⭸i E
ž
y ⭸ ⭸h j/
siÝ
s1 varŽYi.ž
⭸i/
.Generalizing from this typical element to the entire matrix, the information matrix has the form
IIIII
sXXWX, Ž4.26.whereWis the diagonal matrix with main-diagonal elements
wisŽ⭸ir⭸i.2rvarŽYi.. Ž4.27. The asymptotic covariance matrix of ˆ is estimated by
$ ˆ
ˆ
y1 Xˆ y1cov
Ž .
 sIIIII
sŽX WX. , Ž4.28.ˆ ˆ Ž .
where Wis Wevaluated at . From 4.27 , the form of W also depends on the link function. We’ll see an example for Poisson GLMs next and for binomial GLMs in Section 5.5.
4.4.7 Likelihood Equations and Covariance Matrix for Poisson Loglinear Model
Ž .
The general Poisson loglinear model 4.4 has the matrix form logsX.
Ž . Ž .
For the log link, islogi, so isexp i and ⭸ir⭸isexp i si.
Ž . Ž .
Since var Yi si, the likelihood equations 4.22 simplify to
y y x s0. 4.29
Ž . Ž .
Ý
i i i j iThese equate the sufficient statistics Ýiy xi i j for  to their expected values.
INFERENCE FOR GENERALIZED LINEAR MODELS 139 Also, since
wisŽ⭸ir⭸i.2rvarŽYi.si
ˆ Xˆ y1 ˆ
Ž . Ž .
the estimated covariance matrix 4.28 of  is X WX , where W is the diagonal matrix with elements of ˆ on the main diagonal.