简体   繁体   English

在 R 中使用稳健方差分析进行事后比较的问题

[英]Problem with post hoc comparison using Robust ANOVA in R

I am trying to conduct a robust ANOVA including post-hoc test using WRS2 package in R.我正在尝试在 R 中使用 WRS2 package 进行稳健的方差分析,包括事后测试。 My data structure is as such: 1 dependent variable (res) 2 independent variables: between (group) - within (bla) 1 ID variable to refer to subjects (id)我的数据结构是这样的:1个因变量(res)2个自变量:(组)之间-(bla)1个ID变量引用主题(id)

My code looks like this:我的代码如下所示:

fileHB=read.csv2("trial_II.csv");
fileHB$Hb=as.numeric(fileHB$Hb);

m1 <- WRS2::bwtrim(res ~ Group*Bla,id=id, data = fileHB)

Up until this point it works fine but when I try to check post hoc using this line of code:到目前为止,它工作正常,但是当我尝试使用这行代码检查事后:

sppba(res ~ Group*Bla,id,data = fileHB)

I receive the following error:我收到以下错误:

error in combn(levels(mf[, fixvar]), 2) : n < m

I don't know what to do here and I tried debugging but I cannot seem to find the error.我不知道该怎么做,我尝试调试,但似乎找不到错误。 I checked my data and everything is complete - so no missing data.我检查了我的数据,一切都完成了——所以没有丢失数据。 Also, the indexing of subject etc. is correct.此外,主题等的索引是正确的。 I would really aprreciate help on this issue.在这个问题上,我真的很感激帮助。

I would be happy to get a response!我很乐意得到回应!

Best最好的

I had the same error a while ago, try to covert the group as factor.前段时间我遇到了同样的错误,尝试将组转换为因素。 For me tjos spmved my issue对我来说,tjos 解决了我的问题

fileHB$Group <- as.factor(fileHB$Group)

If not, another possibility is that you have some missing data so then your groups have not equal sizes.如果不是,另一种可能性是您缺少一些数据,因此您的组的大小不相等。 Then for me the posthoc didnt work and I had to do imputation but it depends on how would be your missing cases which type of strategy it is better for you.然后对我来说,事后没有工作,我不得不进行估算,但这取决于您的缺失案例如何,哪种策略更适合您。

Hi the "sppba" function is not a post-hoc test.嗨,“sppba” function 不是事后测试。 It is an omnibus test.这是一个综合测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM