64
$\begingroup$

How can I interpret the main effects (coefficients for dummy-coded factor) in a Poisson regression?

Assume the following example:

treatment     <- factor(rep(c(1, 2), c(43, 41)), 
                        levels = c(1, 2),
                        labels = c("placebo", "treated"))
improved      <- factor(rep(c(1, 2, 3, 1, 2, 3), c(29, 7, 7, 13, 7, 21)),
                        levels = c(1, 2, 3),
                        labels = c("none", "some", "marked"))    
numberofdrugs <- rpois(84, 10) + 1    
healthvalue   <- rpois(84, 5)   
y             <- data.frame(healthvalue, numberofdrugs, treatment, improved)
test          <- glm(healthvalue~numberofdrugs+treatment+improved, y, family=poisson)
summary(test)

The output is:

Coefficients:
                 Estimate Std. Error z value Pr(>|z|)    
(Intercept)       1.88955    0.19243   9.819   <2e-16 ***
numberofdrugs    -0.02303    0.01624  -1.418    0.156    
treatmenttreated -0.01271    0.10861  -0.117    0.907   MAIN EFFECT  
improvedsome     -0.13541    0.14674  -0.923    0.356   MAIN EFFECT 
improvedmarke    -0.10839    0.12212  -0.888    0.375   MAIN EFFECT 
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

I know that the incident rate for numberofdrugs is exp(-0.023)=0.977. But how do I interpret the main effects for the dummy variables?

$\endgroup$

migrated from stackoverflow.com May 21 '11 at 21:38

This question came from our site for professional and enthusiast programmers.

  • $\begingroup$ A similar answer (but framed more mathematically) can be found here: How to interpret parameter estimates in Poisson GLM results. $\endgroup$ – gung Dec 13 '14 at 16:08
  • $\begingroup$ It's interesting that the referenced question was closed as off-topic. (I wouldn't have agreed that it was off-topic, since any answer would also apply to the output of any stats program that returned a table of coefficients to the user, and do agree with you that it's close-worthy on the basis of being a duplicate.) It seems to me that the SO community is too "tight" on questions that ask for interpretation of output from R. They are not really on-topic for StackOverflow since there is no suggestion that coding help is needed. $\endgroup$ – DWin Apr 4 '17 at 18:44
  • $\begingroup$ @DWin, I don't think interpreting statistical output is off topic on Cross Validated. I voted to close that question as a duplicate of this. Others seem to have voted OT, I gather, because it seemed to them that the OP "dump[ed their] computer output there and [hoped someone would] run the stat analysis for [them]". $\endgroup$ – gung Apr 6 '17 at 18:15
  • 1
    $\begingroup$ @gung: I was clear that it wasn't you that was calling it OT. Your comments were clear on that point. (I thought I was agreeing with you.) The "reason" listed on a close vote is often a majority or plurality decision. $\endgroup$ – DWin Apr 6 '17 at 19:12
  • $\begingroup$ Relevant: stats.stackexchange.com/questions/142338/… $\endgroup$ – kjetil b halvorsen May 11 '17 at 21:03
56
$\begingroup$

The exponentiated numberofdrugs coefficient is the multiplicative term to use to calculate the estimated healthvalue when numberofdrugs increases by 1 unit. In the case of categorical (factor) variables, the exponentiated coefficient is the multiplicative term relative to the base (first factor) level for that variable (since R uses treatment contrasts by default). The exp(Intercept) is the baseline rate, and all other estimates would be relative to it.

In your example the estimated healthvalue for someone with 2 drugs, "placebo" and improvement=="none" would be (using addition inside exp as the equivalent of multiplication):

 exp( 1.88955 + 2*-0.02303 + 0 + 0 )
 [1] 6.318552

While someone on 4 drugs, "treated", and "some" improvement would have an estimated healthvalue of

exp( 1.88955 + 4*-0.02303 + -0.01271 + -0.13541)
[1] 5.203388

ADDENDUM: This is what it means to be "additive on the log scale". "Additive on the log-odds scale" was the phrase that my teacher, Barbara McKnight, used when emphasizing the need to use all term coefficients that applied in logistic regression when doing any kind of prediction. You add first all the coefficients times covariate values and then exponentiate. The way to return coefficients from regression objects in R is generally to use the coef() extractor function (done with a different random realization below):

 coef(test)
  #   (Intercept)    numberofdrugs treatmenttreated     improvedsome   improvedmarked 
  #   1.18561313       0.03272109       0.05544510      -0.09295549       0.06248684 

So the calculation of the estimate for a subject with 4 drugs, "treated", with "some" improvement would be:

 exp( sum( coef(test)[ c(1,2,3,4) ]* c(1,4,1,1) ) ) 
 [1] 3.592999

And the linear predictor for that case should be the sum of:

 coef(test)[c(1,2,3,4)]*c(1,4,1,1) 
 #    (Intercept)    numberofdrugs treatmenttreated     improvedsome 
 #     1.18561313       0.13088438       0.05544510      -0.09295549

These principles should apply to any stats package that returns a table of coefficients to the user. The method and principles is more general than might appear from my use of R.


I'm copying selected clarifying comments since they 'disappear' in the default display:

Q: So you interpret the coefficients as ratios! Thank you! – MarkDollar

A: The coefficients are the natural_logarithms of the ratios. – DWin

Q2: In that case, in a poisson regression, are the exponentiated coefficients also referred to as "odds ratios"? – oort

A2: No. If it were logistic regression they would be but in Poisson regression, where the LHS is number of events and the implicit denominator is the number at risk, then the exponentiated coefficients are "rate ratios" or "relative risks".

$\endgroup$
  • $\begingroup$ So it let you vote twice? How nice. I thought offering an R code implementation of the interpretation might rescue it from the forces of classification rectitude. The OP composed a nice self contained example. Maybe I should have demonstrated an extractor function, so I think I will. $\endgroup$ – DWin May 22 '11 at 3:00
  • $\begingroup$ Yes, I upvoted your response on SO, then it moved here and I upvoted again :) $\endgroup$ – Brandon Bertelsen May 22 '11 at 4:35
  • $\begingroup$ Thanks so far! I know the realtion between the dummies and cavariables, but I'm just interested of how to interpret the Main effects (I marked them). Is it possible to take teh incidient rate from a Main effects, for example for the dummy treated 'exp(-0.012)=0.99' and interpret it as the rate from which the healtvalue decreases, when switching from reference category to treated? It must be, no? $\endgroup$ – MarkDollar May 22 '11 at 8:40
  • $\begingroup$ The exponentiated coefficients are always interpreted as ratios. Ratios of 'what' to 'what' depends on the units of analysis. 'Rates' are different, having an implicit number and time value. So if you are willing to change your terminology, then perhaps,'yes". Best answers come from describing the analysis situation fully. $\endgroup$ – DWin May 22 '11 at 14:01
  • $\begingroup$ Ah ok this is what I wanted to know. So you interpret the coefficients as ratios! Thank you! $\endgroup$ – MarkDollar May 23 '11 at 15:34