r-使用一般线性模型(GLM)后的事后测试



我想看看三组(klasse(和他们的攻击行为(通过计算攻击性互动的数量(之间是否有显著差异。这种情况无关紧要,但必须加以考虑。我用一个一般的线性模型比较了各组之间的相互作用,并使用泊松家族作为计数数据。

这是在Rstudio:中输入的数据

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 = "data.frame", row.names = c(NA, 
-32L))

它是非参数数据,因此不是正态分布的这是我在Rstudio中使用的代码:

agmodel1<-glm(agressiekrab~klasse*situatie,poisson) 
summary(agmodel1)

结果是:

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(>|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

现在,我想使用一个事后测试来看看de group(klasse(之间的差异在哪里。我尝试了成对的wilcox测试,但它不能让我进行二对二的比较。我不知道如何解释结果。我也尝试过TukeyHSD测试,但也不起作用(由于非参数数据,我认为这是不对的(

pairwise.wilcox.test(agressiekrab,klasse*situatie,P.adj="Bonj")
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

tukey方法给出了一个错误:

TukeyHSD(aov(agressiekrab~klasse*situatie))    
Error in TukeyHSD.aov(aov(agressiekrab ~ klasse * situatie)) : 
no factors in the fitted model
TukeyHSD(aov(agressiekrab~factor(klasse)*factor(situatie)))

相关内容

  • 没有找到相关文章

最新更新