I am trying to conduct a robust ANOVA including post-hoc test using WRS2 package in R. 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)
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
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.