Learning Outcomes
By the end of this section, students will be able to:
- Open datasets in their chosen statistical software programme
- Explore datasets and understand what data they have
- Use basic commands to edit their data
Video C2.4 – Poisson Regression (4 minutes)
C2.4 PRACTICAL: R
Poisson regression can be used to model the log(count of events) or the log(rate), since a rate is equivalent to the ‘count of events’ divided by a period of follow-up time. Here, we show a Poisson regression modelling the log(rate of disease) as the outcome.
In R, we can use the glm() command to fit a Poisson regression model as follows:
glm(formula, data, family = poisson(link = “log”))
The command glm() is the same command that was used to fit a logistic regression model in the previous module. The only difference is that in Poisson regression we use the family poisson(link = “log”), whereas in logistic regression we use the family binomial(link = “logit”). Note that we use the offset(time) when we specify the formula of the Poisson regression to specify follow-up time. If you do not use the offset(time) to specify the period of follow-up time, then you will be analysing a log(count) [rather than rate].
To estimate the incidence rate ratio of death for current smokers compared to non-smokers, we run the following command:
> model <- glm(death ~ offset(log(fu_years)) + currsmoker, data = df, family = poisson(link = “log”))
> summary(model)
Call:
glm(formula = death ~ offset(log(fu_years)) + currsmoker, family = poisson(link = “log”),Â
  data = df)
Deviance Residuals:Â
  Min    1Q  Median    3Q    Max Â
-1.0083 Â -0.9267 Â -0.8854 Â 0.9764 Â 3.3032 Â
Coefficients:
      Estimate Std. Error  z value Pr(>|z|)  Â
(Intercept) -2.98556 Â Â 0.02770 -107.770 Â <2e-16 ***
currsmoker  0.16891   0.07318   2.308   0.021 * Â
—
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for poisson family taken to be 1)
  Null deviance: 5138.5  on 4320  degrees of freedom
Residual deviance: 5133.3 Â on 4319 Â degrees of freedom
 (6 observations deleted due to missingness)
AIC: 8179.3
Number of Fisher Scoring iterations: 6
The estimate in the row for ‘currsmoker’ is the rate ratio of death for current smokers compared to non-smokers. This output shows that the rate of death is 18% higher in current smokers compared to non-smokers (RR 1.18, 95% CI: 1.03-1.37). This association is statistically significant (p=0.02).
Assumptions of Poisson regression
Poisson regression requires that within an exposure group such as smokers or non-smokers, the rate of the event of interest (such as death) stays constant over time, a very strong assumption. A cohort study often involves follow-up over many years and it is unrealistic, because of changes in age, to assume that the rate stays unchanged over follow-up.
- Question C2.4: Use a Poisson regression to assess if current smoking associated with the rate of death, once adjusted for age group and frailty?
Answer
The command and output is:> model <- glm(death ~ offset(log(fu_years)) + currsmoker + age_grp + frailty, data = df, family = poisson(link = “log”))
> summary(model)
Call:
glm(formula = death ~ offset(log(fu_years)) + currsmoker + age_grp +Â
  frailty, family = poisson(link = “log”), data = df)
Deviance Residuals:Â
  Min    1Q  Median    3Q    Max Â
-2.0348 Â -0.8082 Â -0.5892 Â 0.7480 Â 3.2916 Â
Coefficients:
      Estimate Std. Error z value Pr(>|z|)  Â
(Intercept) -4.35993 Â Â 0.10691 -40.783 Â < 2e-16 ***
currsmoker  0.22259   0.07330  3.037  0.00239 **Â
age_grp2 Â Â 0.54990 Â Â 0.09650 Â 5.698 1.21e-08 ***
age_grp3 Â Â 0.94373 Â Â 0.09820 Â 9.610 Â < 2e-16 ***
age_grp4 Â Â 1.38579 Â Â 0.10113 Â 13.703 Â < 2e-16 ***
frailty2 Â Â 0.26967 Â Â 0.10491 Â 2.571 Â 0.01015 * Â
frailty3 Â Â 0.46882 Â Â 0.10116 Â 4.634 3.58e-06 ***
frailty4 Â Â 0.76742 Â Â 0.09329 Â 8.226 Â < 2e-16 ***
frailty5 Â Â 1.33908 Â Â 0.08988 Â 14.899 Â < 2e-16 ***
—
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for poisson family taken to be 1)
  Null deviance: 5138.5  on 4320  degrees of freedom
Residual deviance: 4352.0 Â on 4312 Â degrees of freedom
 (6 observations deleted due to missingness)
AIC: 7412
Number of Fisher Scoring iterations: 6
The rate of death is 23% higher in current smokers compared to non-smokers, once adjusted for age group and frailty (RR 1.25, 95% CI: 1.09-1.43). This association is statistically significant (p=0.002).
C2.4 PRACTICAL: Stata
There are several Stata commands which allow the analysis of data with follow-up time and rates. These are broadly grouped into ‘stand-alone’ commands (e.g. ‘poisson’) and those which are used after the ‘stset’ command which tells Stata that you have ‘survival data’. You can run a Poisson regression using the ‘stset’ command, followed by the ‘streg’ command, but we are not covering that here. For more information, see the recommended readings at the end of this module.
Poisson regression can be used to model the log(count of events) or the log(rate), since a rate is equivalent to the ‘count of events’ divided by a period of follow-up time.
Here, we show a Poisson regression modelling the log(rate of disease) as the outcome. In Stata, we can use the ‘poisson’ command as follows:
poisson death currsmoker, e(fu_years) irr
The command poisson works similarly to other regression commands such as logistic and regress, but note we use the ‘e’ option to specify follow-up time (see the help file for more details on this). If you do not use the ‘e’ option to specify the period of follow-up time, then you will be analysing a log(count) [rather than rate].
If we run the ‘poisson’ command above, we get the following output:
poisson death currsmoker,e(fu_years) irr
Iteration 0:Â Â log likelihood = -4087.6737Â
Iteration 1:Â Â log likelihood = -4087.6737Â
Poisson regression                                     Number of obs = 4,321
                                                       LR chi2(1)   =  5.12
                                                       Prob > chi2  = 0.0237
Log likelihood = -4087.6737Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Pseudo R2Â Â Â Â = 0.0006
——————————————————————————
      death |       IRR  Std. err.     z   P>|z|    [95% conf. interval]
————-+—————————————————————-
 currsmoker |  1.184012  .0866404    2.31  0.021    1.025815   1.366605
      _cons |  .0505112  .0013993 -107.77  0.000    .0478417   .0533296
ln(fu_years) |Â Â Â Â Â Â Â Â Â 1Â (exposure)
——————————————————————————
Note: _cons estimates baseline incidence rate.
The ‘IRR’ coefficient in the row for ‘currsmoker’ is the rate ratio of death for current smokers compared to non-smokers. This output shows that the rate of death is 18% higher in current smokers compared to non-smokers (RR 1.18, 95% CI: 1.03-1.37). This association is statistically significant (p=0.02).
The row ‘ln(fu_years)’ is always set at 1, and this is correct (even though it looks odd on the output). This refers to the follow-up time, which we set at 1 so that the regression does not multiply the variable denoting the follow-up time by any sort of constant.
Assumptions of Poisson regression
Poisson regression requires that within an exposure group such as smokers or non-smokers, the rate of the event of interest (such as death) stays constant over time, a very strong assumption. A cohort study often involves follow-up over many years and it is unrealistic, because of changes in age, to assume that the rate stays unchanged over follow-up.
One way to deal with this assumption is to split follow-up time using the ‘stsplit’ command in Stata, and model the rate of death in separate time bands of follow-up. The rate of death for smokers vs non-smokers can vary between time bands (such as the first 5 years of follow-up, compared to follow-up over years 6-10), as long as the rate is generally constant within time bands. This is outside the scope of introductory module on Poisson regression to cover, so please see the recommended readings at the end of the module.
- Â Question C2.4: Use a Poisson regression to assess if current smoking associated with the rate of death, once adjusted for age group and frailty?
Answer
The command and output is:
poisson death currsmoker age_grp frailty,e(fu_years) irr
Iteration 0:Â Â log likelihood = -3706.1288Â
Iteration 1:Â Â log likelihood = -3706.1281Â
Iteration 2:Â Â log likelihood = -3706.1281Â
Poisson regression               Number of obs = 4,321
            LR chi2(3)   = 768.21
                                                                 Prob > chi2  = 0.0000
Log likelihood = -3706.1281Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Pseudo R2Â Â Â Â = 0.0939
———————————————————————————
   death |       IRR  Std. err.     z   P>|z|    [95% conf. interval]
————-+——————————————————————-
 currsmoker |  1.234536  .0903537    2.88  0.004    1.069562   1.424958
    age_grp |  1.550334  .0431322   15.76  0.000     1.46806   1.637218
  frailty |  1.403122  .0282948   16.80  0.000    1.348747   1.459689
  _cons |  .0056696  .0005372  -54.59  0.000    .0047086   .0068266
ln(fu_years) |Â Â Â Â Â Â Â Â Â 1Â (exposure)
——————————————————————————–
Note: _cons estimates baseline incidence rate.
The rate of death is 23% higher in current smokers compared to non-smokers, once adjusted for age group and frailty (RR 1.23, 95% CI: 1.07-1.42). This association is statistically significant (p=0.004).
C2.4 PRACTICAL: SPSS
SPSS does not have Poisson regression as an option within its survival analysis menu. A general Poisson regression can be conducted using the function Analyze >> Generalized Linear Models >> Generalized Linear Models and then ticking ‘Poisson Loglinear’ in the ‘Type of Model’ tab. This function does not allow the time component of the survival analysis to be entered, and will give very different results, so SPSS should not be used for Poisson regression on survival data.
Great
No presentation. Please add downloadable presentation