5 IRWLS Algorithm

5.2 Algorithm

The parameter vector β of the GLM is estimated using a solution to th log-likelihood function as follows. In the canonical form, for independent observations y1,…,yn, the likelihood is given by:

ℓ⁢(β1,…,βp)=∑i=1n(yi⁢θi-κ⁢(θi))+∑i=1nlog⁡q⁢(yi).

Next we take the first derivative of ℓ with respect to βr, 1≤r≤p. Note here that θi is a one-to-one function of μi with d⁢μid⁢θi=κ′′⁢(θi) and ηi is a one-to-one function of μi through the link function and finally ηi=𝐱i′⁢𝜷. Hence, by the chain rule:

d⁢ℓd⁢βr=∑i=1nd⁢ℓid⁢θi⁢d⁢θid⁢μi⁢d⁢μid⁢ηi⁢d⁢ηid⁢βr

where

d⁢ℓid⁢θi=yi-κ′⁢(θi)=yi-μi  d⁢μid⁢θi=κ′′⁢(θi)=var⁢(Yi)  d⁢ηid⁢βr=xi,r.

This leads to the likelihood equations:

d⁢ℓd⁢βr=∑i=1n(y-μi)⁢xi,rvar⁢(Yi)⁢d⁢μid⁢ηi,for⁢1≤r≤p.

We denote the above likelihood vector form by:

𝐮=∑i=1n(yi-μi)⁢𝐱i⁢1var⁢(Yi)⁢(d⁢μid⁢ηi)2⁢d⁢ηid⁢μi=∑i=1nWi⁢(yi-μi)⁢d⁢ηid⁢μi⁢𝐱i,

where

Wi=1var⁢(Yi)⁢(d⁢μid⁢ηi)2=1var⁢(Yi)⁢{g′⁢(μi)}2. (5.2)

In the sequel, all sums are over i from 1 to n, unless otherwise and the subscript i is omitted from the summands. The r-the component, 1≤r≤p of 𝐮 is:

ur=∑W⁢(y-μ)⁢d⁢ηd⁢μ⁢xr (5.3)

and let the expectation of the negative Hessian matrix be:

𝐈=𝔼⁢[-d⁢ℓ2d⁢βr⁢d⁢βs],

where both 𝐮 and 𝐈 are evaluated at the current estimate 𝐛 of 𝜷. Then from (5.3), for 1≤r,s≤p,

-d⁢urd⁢βs =-∑[(y-μ)⁢dd⁢βs⁢{W⁢d⁢ηd⁢μ}⁢xr+W⁢d⁢ηd⁢μ⁢xr⁢dd⁢βs⁢(y-μ)]
=-∑[(y-μ)⁢dd⁢βs⁢{W⁢d⁢ηd⁢μ}⁢xr-W⁢xr⁢d⁢ηd⁢μ⁢d⁢μd⁢βs]
=-∑[(y-μ)⁢dd⁢βs⁢{W⁢d⁢ηd⁢μ}⁢xr]+∑W⁢xr⁢d⁢ηd⁢βs
=-∑[(y-μ)⁢dd⁢βs⁢{W⁢d⁢ηd⁢μ}⁢xr]+∑W⁢xr⁢xs.

Hence:

Ir,s=-𝔼⁢[d⁢urd⁢βs]=-∑[𝔼⁢[Y-μ]⁢dd⁢βs⁢{W⁢d⁢ηd⁢μ}⁢xr]+∑W⁢xr⁢xs=∑W⁢xr⁢xs. (5.4)

To apply Fisher’s scoring method, note that the r-th component of 𝐈𝐛 is:

∑sIr,s⁢bs=∑s∑i=1nWi⁢xi,r⁢xi,s⁢bs=∑i=1nWi⁢xi,r⁢∑sxi,s⁢bs=∑i=1nWi⁢xi,r⁢ηi (5.5)

where ηi=𝐱i′⁢𝐛 is the i-th linear predictor evaluated estimate. Hence from (5.3) and (5.5):

𝐈𝐛+𝐮=∑W⁢{η+(y-μ)⁢d⁢ηd⁢μ}⁢𝐱=∑W⁢z⁢𝐱, (5.6)

where

zi=zi⁢(𝐛)=ηi+(yi-μi)⁢d⁢ηid⁢μi=𝐱i′⁢𝐛+(yi-μi)⁢g′⁢(μi) (5.7)

with all quantities (μi and ηi) evaluated at the current estimate 𝐛. Consequently from (5.1), (5.5) and (5.6):

𝐛*=𝐈-1⁢(𝐈𝐛+𝐮)=(∑i=1nWi⁢𝐱i′⁢𝐱i)-1⁢(∑i=1nWi⁢𝐱i′⁢𝐳i)=(𝐗′⁢𝐖𝐗)-1⁢𝐗′⁢𝐖𝐳

where 𝐖 is a diagonal matrix with i-th diagonal entry Wi of (5.2).

Remark 1 on implementation: For implementing IRWLS, start with initial 𝐛 and first compute the linear predictor ηi=𝐱i′⁢𝐛. Then calculate μi=g-1⁢(ηi); however, often the initial μi’s are taken as Yi’s and one evaluates ηi=g⁢(μi) (There are obvious problems with such choice, for example, when some yi’s are zero and one has to take the logarithm as in the Poisson case). Finally, zi⁢(b) of (5.7) is evaluated and the iteration continues.

Remark 2: Consider a multiple linear regression model with observed zi’s of (5.7) defined as:

zi=𝐱i′⁢𝜷+(yi-μi)⁢d⁢ηid⁢μi =𝐱i′⁢𝜷+(yi-μi){var⁢(Yi)}1/2⁢[{var⁢(Yi)}1/2d⁢μid⁢ηi]
=𝐱i′⁢𝜷+(yi-μi){var⁢(Yi)}1/2⁢Wi-1/2 (5.8)

Since 𝔼⁢[(Yi-μi)/var⁢(Yi)1/2]=0, the updated estimate 𝐛* is nothing but the weighted least squares estimate of 𝜷 with weights given by Wi’s, where these weights and zi’s are calculated using the current value of 𝐛 since that is the best approximation at the current stage. The hypothetical model (5.8) can be motivated from a one-step Taylor approximation:

g⁢(yi)≈g⁢(μi)+(yi-μi)⁢g′⁢(μi)=𝐱i′⁢𝜷+(yi-μ)⁢d⁢ηid⁢μi

Remark 3: From (5.4), -𝔼⁢[d⁢urd⁢βs]=-d⁢urd⁢βs if Wi⁢d⁢ηid⁢μi is a constant function of 𝜷. This happens under the canonical link function and consequently Fisher’s scoring method and Newton-Raphson method for finding 𝜷^ coincide resulting in fast convergence. This is because:

Wi⁢d⁢ηid⁢μi=1var⁢(Yi)⁢g′⁢(μi)=1v⁢(μi)⁢g′⁢(μi)

and for this to be free from 𝜷, g′⁢(μ)⁢v⁢(μ) is a constant or:

g⁢(μ)=c⁢∫1v⁢(μ)⁢𝑑μ.

In particular:

  • •

    Simple linear regression – v⁢(μ)=1, g⁢(μ)=μ

  • •

    Poisson regression – v⁢(μ)=μ, g⁢(μ)=log⁡(μ)

  • •

    Logistic regression – v⁢(μ)=μ⁢(1-μ), g⁢(μ)=log⁡{μ/(1-μ)}