我尝试了两种不同的方式进行方差分析:
1.
lm(os ~ cd3_abs, data = dd) %>% anova()
这给出了这个错误:
Error in if (ssr < 1e-10 * mss) warning("ANOVA F-tests on an essentially perfect fit are unreliable") :
missing value where TRUE/FALSE needed
aov(formula = compete2 ~ cd3_abs, data = dd)
这给出了这个错误:
"Error in levels(x)[x] : only 0's may be mixed with negative subscripts"
我的数据如下:
cd3_abs OS
1 1.38 0
2 1.19 1
3 NA 1
4 2.32 0
5 0.9 1
6 3.3 1
两个明显的问题:1)由于你的
os
是二元的,你应该使用逻辑回归; 2) 您的 cd3_abs
列有 NA
,应将其排除在方差分析中。典型代码如下:
library(lme4)
glmer(os ~ cd3_abs, data = dd%>%na.omit(), family=binomial)