否 ANOVA,它假设一个正态分布的结果变量(除其他外)。有“老派”转换需要考虑,但我更喜欢逻辑回归(当只有一个自变量时相当于卡方,就像你的情况一样)。与卡方检验相比,使用逻辑回归的优势在于,如果您发现整体检验(类型 3)的显着结果,您可以轻松地使用线性对比来比较治疗的特定水平。例如 A 对 B、B 对 C 等。
为清楚起见添加了更新:
获取手头的数据(来自Allison的博士后数据集)并使用变量 cits 如下,这是我的观点:
postdocData$citsBin <- ifelse(postdocData$cits>2, 3, postdocData$cits)
postdocData$citsBin <- as.factor(postdocData$citsBin)
ordered(postdocData$citsBin, levels=c("0", "1", "2", "3"))
contrasts(postdocData$citsBin) <- contr.treatment(4, base=4) # set 4th level as reference
contrasts(postdocData$citsBin)
# 1 2 3
# 0 1 0 0
# 1 0 1 0
# 2 0 0 1
# 3 0 0 0
# fit the univariate logistic regression model
model.1 <- glm(pdoc~citsBin, data=postdocData, family=binomial(link="logit"))
library(car) # John Fox package
car::Anova(model.1, test="LR", type="III") # type 3 analysis (SAS verbiage)
# Response: pdoc
# LR Chisq Df Pr(>Chisq)
# citsBin 1.7977 3 0.6154
chisq.test(table(postdocData$citsBin, postdocData$pdoc))
# X-squared = 1.7957, df = 3, p-value = 0.6159
# then can test differences in levels, such as: contrast cits=0 minus cits=1 = 0
# Ho: Beta_1 - Beta_2 = 0
cVec <- c(0,1,-1,0)
car::linearHypothesis(model.1, cVec, verbose=TRUE)