title: Post-hoc test after using general linear model (GLM)
body: <p>I want to see if there's a significant difference between 3 groups (klasse) and their agressive behaviour (by counting the number of agressive interactions). The situation is not relevant, but it must be taken into account. I compared the agressive interactions between the groups with a general linear model and I used the family poisson for the count data.</p>
  <p>This is the data input in Rstudio:</p>
  <pre><code>data.frame(agressiekrab=c(8,5,1,10,6,12,4,17,1,1,5,9,11,2,3,0,21,17,4,1,10,4,14,15,22,8,19,0,6,16,4,10), klasse=c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3), situatie=c(1,1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,1,1,1,2,2,2,1,1,1,1,1,2,2,2,2,2))
  
  structure(list(agressiekrab = c(8, 5, 1, 10, 6, 12, 4, 17, 1, 
  1, 5, 9, 11, 2, 3, 0, 21, 17, 4, 1, 10, 4, 14, 15, 22, 8, 19, 
  0, 6, 16, 4, 10), klasse = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
  1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
  ), situatie = c(1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 
  3, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2)), class = &quot;data.frame&quot;, row.names = c(NA, 
  -32L))
  </code></pre>
  <p>It's non-parametric data, so not normally distributed
  This is the code that I used in Rstudio:</p>
  <pre><code>agmodel1&lt;-glm(agressiekrab~klasse*situatie,poisson) 
  summary(agmodel1)
  </code></pre>
  <p>The result is this:</p>
  <pre><code>Call:
  glm(formula = agressiekrab ~ klasse * situatie, family = poisson)
  
  Deviance Residuals: 
     Min      1Q  Median      3Q     Max  
  -3.688  -1.623  -0.462   1.306   3.718  
  
  Coefficients:
                  Estimate Std. Error z value Pr(&gt;|z|)    
  (Intercept)       1.5198     0.3812   3.987 6.68e-05 ***
  klasse            0.7223     0.1827   3.953 7.71e-05 ***
  situatie          0.0905     0.2112   0.428  0.66836    
  klasse:situatie  -0.3251     0.1169  -2.781  0.00542 ** 
  ---
  Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
  
  (Dispersion parameter for poisson family taken to be 1)
  
      Null deviance: 171.19  on 31  degrees of freedom
  Residual deviance: 120.51  on 28  degrees of freedom
  AIC: 240.09
  
  Number of Fisher Scoring iterations: 5
  </code></pre>
  <p>Now i would like to use a post-hoc test to see where the difference is between de groups (klasse). I tried the pairwise wilcox test, but it doesn't give me two-by-two comparisons. I don't know how to interpret the outcome.
  I also tried the TukeyHSD test, but that didn't work either (and I don't think it's right because of the non-parametric data)</p>
  <pre><code>pairwise.wilcox.test(agressiekrab,klasse*situatie,P.adj=&quot;Bonj&quot;)
     Pairwise comparisons using Wilcoxon rank sum test 
     data:  agressiekrab and klasse * situatie £
        1 2 3 4
      2 1 - - -  
      3 1 1 - -
      4 1 1 1 -
      6 1 1 1 1 
    P value adjustment method: holm
  </code></pre>
  <p>The tukey method gives an error:</p>
  <pre><code>TukeyHSD(aov(agressiekrab~klasse*situatie))    
    Error in TukeyHSD.aov(aov(agressiekrab ~ klasse * situatie)) : 
    no factors in the fitted model
  </code></pre>