I have a dataset in which I compare the total number (the summed number of birds over a couple of weeks) of birds across different distances (continuous factor). I hypothesize that the numbers of birds is the highest at the first distance and declines. The model I used was a GLM.
I now have a significant effect of the Distance, which is what I was expecting. But what can I use to see which of the distances differ from each other? I've tried this but that didn't work.
post1 <- glht(m5, family = poisson())
summary(m5, test = adjusted())
The emmeans package does not work.
This question can be deleted, the answer did not work and I did not conduct a post-hoc.
Best Answer
You want the
emmeans
package. It is remarkably broad and effective. Below, I simulate data that might look like yours. Then I calculate all pairwise comparisons and then just the contrast of interest that you are interested in.There are tons of great vignettes to help learn
emmeans
, e.g.:emmeans
https://cran.r-project.org/web/packages/emmeans/vignettes/models.htmlemmeans
https://cran.r-project.org/web/packages/emmeans/vignettes/sophisticated.html