我使用R的library agricolae中包含的library agricolae:
数据(甘薯)这个数据集包含两个变量:产量(连续变量)和病毒(因子变量)。
由于Levene检验是显着的,我不能假设方差的同质性,我将Welch检验应用于R,而不是单向的ANOVA,然后是Tukey。
然而,这些问题来自于我申请后测时的问题。在Tukey测试中,我使用library(agricolae)并显示病毒组之间的上标字母。因此,没有问题。
然而,为了执行游戏-豪厄尔死后,我使用library(userfriendlyscience)和我获得游戏豪威尔输出,但我不可能获得一个字母上标比较病毒组,因为它是通过library(agricolae)获得的。
所用的代码如下:
图书馆(方便用户科学) 数据(甘薯) 单程<-单向(甘薯$病毒,y=sweetpotato$yield,posthoc = 'games-howell') 单程
我尝试使用cld()导入以前的library(multcompView),但不起作用。
有人能帮我吗?
提前谢谢。
发布于 2018-01-17 15:19:53
目前userfriendlyscience中不存在此功能。通过查看带有临时测试结果的dataframe的行名,您可以看到哪一个意思不同,以及哪个p值。我不确定哪个包包含sweetpotato数据集,但使用R附带的ChickWeight数据集(并在oneway手册页面中使用):
oneway(y=ChickWeight$weight, x=ChickWeight$Diet, posthoc='games-howell');产量:
### (First bit removed as it's not relevant.)
### Post hoc test: games-howell
diff ci.lo ci.hi t df p
2-1 19.97 0.36 39.58 2.64 201.38 .044
3-1 40.30 17.54 63.07 4.59 175.92 <.001
4-1 32.62 13.45 51.78 4.41 203.16 <.001
3-2 20.33 -6.20 46.87 1.98 229.94 .197
4-2 12.65 -10.91 36.20 1.39 235.88 .507
4-3 -7.69 -33.90 18.52 0.76 226.16 .873前三行比较组2、3和4到1:使用alpha = .05,1和2有相同的方法,但3和4更高。这允许您计算multCompLetters在multcompView中所需的逻辑向量。基于?multcompView手册页中的示例
### Run oneway anova and store result in object 'res'
res <- oneway(y=ChickWeight$weight, x=ChickWeight$Diet, posthoc='games-howell');
### Extract dataframe with post hoc test results,
### and overwrite object 'res'
res <- res$intermediate$posthoc;
### Extract p-values and comparison 'names'
pValues <- res$p;
### Create logical vector, assuming alpha of .05
dif3 <- pValues > .05;
### Assign names (row names of post hoc test dataframe)
names(dif3) <- row.names(res);
### convert this vector to the letters to compare
### the group means (see `?multcompView` for the
### references for the algorithm):
multcompLetters(dif3);这将产生最终结果:
2 3 4 1
"a" "b" "c" "abc"这就是你需要的,对吧?
我在userfriendlyscience中添加了这个功能,但是这个新版本还需要一段时间才能在CRAN上运行。同时,如果您愿意,可以在https://github.com/Matherion/userfriendlyscience/blob/master/R/oneway.R上获得此更新的源代码(按“raw”按钮即可获得源代码的轻松下载版本)。
注意,如果需要此更新版本,则需要将参数posthocLetters设置为TRUE,因为默认情况下它是FALSE。例如:
oneway(y=ChickWeight$weight,
x=ChickWeight$Diet,
posthoc='games-howell',
posthocLetters=TRUE);发布于 2019-02-21 23:46:32
不是应该是dif3 <- pValues < .05,而不是dif3 <- pValues > .05吗?
这样,如果分布是“相同的”,字母是相同的(这是,没有证据表明它们是不同的)。
如果我理解错了,请纠正我。
https://stackoverflow.com/questions/48280985
复制相似问题