我想要测试有无疫苗的啮齿动物存活病毒的数量之间是否有关联。这是我的数据:
Treatment Number of deaths Number of Survivors
Vaccinated 11 36
not vaccinated 24 26下面是我把它输入R的方式:
dframe1 <- read.csv(file.choose())
names(dframe1)
# [1] "Treatment" "Number.of.deaths" "Number.of.survivors"
count <- table (dframe1$Number.of.deaths, dframe1$Number.of.survivors)
count
# 26 36
# 11 0 1
# 24 1 0
chisq.test(count)
# Pearson's Chi-squared test with Yates' continuity correction
#
# data: count
# X-squared = 0, df = 1, p-value = 1
# Warning message:
# In chisq.test(count) : Chi-squared approximation may be incorrect我做对了吗?
如果没有,请帮忙。干杯。
发布于 2014-03-04 23:47:43
您需要感兴趣的值在表中,而不是像这样的行名和列名:
count <- data.frame(dframe1$Number.of.deaths, dframe1$Number.of.survivors)当您运行您的卡方关联测试时,您现在应该得到以下输出:
chisq.test(count)
# Pearson's Chi-squared test with Yates' continuity correction
# data: count
# X-squared = 5.3331, df = 1, p-value = 0.02092https://stackoverflow.com/questions/22185093
复制相似问题