Lecture 16: Poisson regression and
log-linear model
Reading:
ILRA: 13.3
Regression Analysis, Fall 2015
Institute of Statistics, National Chiao Tung University
December 29, 2015
Brief outline
1. Poisson regression model
2. Offset
3. Parameter interpretation
2 / 16
Poisson regression
• Consider the count data:
• For patients, y = the number of days staying in the
hospital
• For persons, y = the number of phones in one day
(depending on time)
• For brain tissue samples, y = the number of neurotic
tangles per area
• Methods of building regression model for count data:
generalized linear model (GLM)
• Random component: Poisson distribution
f (yi , µi ) =
e −µi µyi i
, E(yi ) = µi , Var(yi ) = µi
yi !
• Systematic and linkage
ln(µi ) = β0 + β1 xi1 + · · · + βK xiK
3 / 16
• Suppose that
λi = rate per unit time for observation i
ti = time for observation i
yi = the number of counts in ti ∼ Poisson(λi ti )
• E(yi ) = λi ti
• Systematic:
ln(µi ) = ln(λi ti ) = β0 + β1 xi1 + · · · + βK xiK + ln(ti ),
where ln(ti ) is called the offset, which is defined as part
of GLM with the coefficient = 1.
• In fact:
ln(λi ) = β0 + β1 xi1 + · · · + βK xiK
4 / 16
Example: seizure example
yi = the number of seizures for person i in 24-hour period
There are 50 persons whose age of onset ≤ 6
There are 50 persons whose age of onset > 6
Within each age of onset group, randomized 10 people to each
dose (dose = 0, 1, 2, 3, 4)
age onset
dose
1
2
3
4
5
person 6
7
8
9
10
total
≤6
0
3
0
3
3
2
5
4
3
2
1
26
≤6
1
1
3
1
2
2
4
2
1
2
5
23
≤6
2
1
3
1
2
2
1
1
4
2
2
19
≤6
3
3
0
2
3
1
3
1
1
0
1
15
≤6
4
1
0
0
1
1
0
0
0
1
2
6
>6
0
1
3
4
0
0
2
0
1
1
0
12
>6
1
3
2
3
1
3
1
0
0
1
0
14
>6
2
0
3
1
0
0
0
1
1
2
1
9
>6
3
0
0
0
0
0
2
1
0
0
1
4
>6
4
0
3
1
0
1
1
1
1
1
0
9
5 / 16
• Model 1: ln(λ) = β0 + β1 × I(age onset > 6)
β̂1 = −0.6173 = log relative rate
= ln λ̂(age onset > 6) − ln λ̂(age onset ≤ 6)
!
λ̂(age onset > 6)
= ln
λ̂(age onset ≤ 6)
β̂0 = 0.5766 = log seizure rate for age onset ≤ 6
• Model 2: ln(λ) = β0 + β1 × I(age onset > 6) + β2 × does
Likelihood ratio test comparing model 2 with model 1:
H0 : β2 = 0 vs. H1 : β2 6= 0
121.1 − 105.9 = 15.2 ∼ χ2 (1) ⇒ p-value = 0.0001
6 / 16
• Fact: K independent variables with each ∼ Poisson(λ),
then sum of these K Poisson ∼ Poisson(K λ)
• Summarize our data as the following:
age onset ≤ 6 > 6
dose
0
26
12
1
23
14
2
19
9
3
15
4
4
6
9
then fit the following two models:
Model 3: (no offset)
ln(10λ) = β0 + β1 × I(age onset > 6) + β2 × does
Model 4: (with offset)
ln(10λ) = β0 + β1 × I(age onset > 6) + β2 × does + ln(10)
7 / 16
• Results
β0
β1
β2
model 2 0.9987
-0.6173 -0.2393
model 3 3.3013 (= 0.9987 + ln(10)) -0.6173 -0.2393
model 4 0.9987
-0.6173 -0.2393
8 / 16
Log-linear model
• Area of focus: contingency table (multinomial data)
• Example: hospital data
hospital
1
2
3
death? chemo
Y
1
N
16
Y
13
N
23
Y
23
N
28
control
31
119
27
83
41
86
• Primary aims: Does either treatment confer a survival
advantage?
• Secondary: Are relative risks comparable across
hospitals?
9 / 16
• Analytic methods:
• χ2 test: pooling over hospitals (if no confounding exists)
• Mantel-Haenszel test (status=hospital)
• Logistic regression (for group data)
hospital
1
1
2
2
3
3
treatment
1 (chemo)
0 (control)
1
0
1
0
# death
1
31
13
27
23
41
# obs
17
150
36
110
51
127
• Log-linear model
10 / 16
Model for 3-way table
• 3-way table: (row (A), column (B), depth (C ))
(i, j, k), i = 1, · · · , I , j = 1, · · · , J, k = 1, · · · , K
• Y` : count in the `th cell, ` = 1, · · · , N(= I × J × K )
Xi`A = I{`th cell in row i } , i = 1, · · · , I
Xj`B = I{`th cell in column j } , j = 1, · · · , J
C
Xk`
= I{`th cell in depth k } , k = 1, · · · , K
• Model (saturated)
ln(E(Y` )) = β0 +
I
X
A
βiA Xi`
+
i=2
+
I X
J
X
A B
βijAB (Xi`
Xj` ) +
i=2 j=2
+
I X
J X
K
X
J
X
j=2
I X
K
X
i=2 k=2
B
βjB Xj`
+
K
X
C
βkC Xk`
k=2
AC
A C
βik
(Xi`
Xk` ) +
J X
K
X
BC
B C
βjk
(Xj`
Xk` )
j=2 k=2
ABC
A B C
βijk
(Xi`
Xj` Xk` )
i=2 j=2 k=2
11 / 16
• Hospital data example:
row (A)
column (B)
depth (A)
⇔ hospital
⇔
⇔ treatment ⇔
⇔ death?
⇔
i = 1, 2, 3
j = 1(control), 2(chemo)
k = 1(N), 2(Y)
ln(E(Y` )) =
hospital
1
1
2
death?
Y
N
Y
2
3
N
Y
3
N
chemo
BC
β0 + β2B + β2C + β22
B
β0 + β2
β0 + β2A + β2B + β2C +
AB
BC
AC
ABC
β22
+ β22
+ β22
+ β222
A
B
AB
β0 + β2 + β2 + β22
β0 + β3A + β2B + β2C +
AB
BC
AC
ABC
β32
+ β22
+ β32
+ β322
A
B
AB
β0 + β3 + β2 + β32
control
β0 + β2C
β0
AC
β0 + β2A + β2C + β22
β0 + β2A
AC
β0 + β3A + β2C + β32
β0 + β3A
12 / 16
Interpretation
• β0 = ln(mean count) for the reference cell (1, 1, 1)
• Main effects:
β2A = ln (mean count, hospital 2, control, not dead)
− ln (mean count, hospital 1, control, not dead)
β2B = ln (mean count, hospital 1, chemo, not dead)
− ln (mean count, hospital 1, control, not dead)
13 / 16
• Two-way interactions:
AB
= [ln (mean count, hospital 2, chemo, not dead)
β22
− ln (mean count, hospital 2, control, not dead)]
− [ln (mean count, hospital 1, chemo, not dead)
− ln (mean count, hospital 1, control, not dead)]
AB
= (β0 + β2A + β2B + β22
) − (β0 + β2A )
− (β0 + β2B ) − β0
m221 m111
= ln
, mijk : expected counts in (i, j, k)
m211 m121
= log odds ratio for association
between hospital (2 vs. 1) and treatment, for not dea
BC
β22
= log odds ratio for association
between treatment and death, for hospital 1
14 / 16
• Three-way interactions:
m222 m211
m122 m111
= ln
− ln
m221 m212
m121 m112
odds ratio for treatment vs. death within hospital 2
= ln
odds ratio for treatment vs. death within hospital 1
ABC
β222
15 / 16
Fitting log-linear models in R
• Use function glm(..., family=poisson) with Y` as the
C
dependent variable and Xi`A , Xj`B , Xk`
as covariates
16 / 16
© Copyright 2026 Paperzz