Question
How can I perform a post-hoc test after a Poisson regression to know which group differ from which other group?
Dummy Data
Here are some dummy data (coded in R
)
set.seed(9)
y = c(rpois(100,6),rpois(50,8))
x = rep(LETTERS[1:3],each=50)
d=data.frame(x=x,y=y)
and here is a Poisson regression showing a highly significant effect of x
on y
.
m = glm(d$y~d$x, family=poisson(link = "log"))
anova(m, test="Chisq")
My thoughts
The only thing I could think of is to perform a series of Poisson regression on subsetted data and then chose some method to correct for multiple testing. Does it seem like a valid solution to you?
dAB = d[d$x!="C",]
m = glm(dAB$y~dAB$x, family=poisson(link = "log"))
anova(m, test="Chisq")
dBC = d[d$x!="A",]
m = glm(dBC$y~dBC$x, family=poisson(link = "log"))
anova(m, test="Chisq")
dAC = d[d$x!="B",]
m = glm(dBC$y~dBC$x, family=poisson(link = "log"))
anova(m, test="Chisq")
pvalues = c(9.504e-5,0.6552,9.504e-5)
p.adjust(pvalues, method="holm")
[1] 0.00028512 0.65520000 0.00028512
As expected the only two groups in x
that do not significantly differ are group A
and group B
.
library(lsmeans);
lsmeans(m, pairwise~x, type="response"))
$\endgroup$