我正在尝试对我的数据执行卡方检验以测试异质性。数据记录了 10 项研究的潜伏期时间。由于缺少值和 0,我真的很挣扎。甚至可以用这样的数据集测试同质性吗?我尝试使用chisq.test
,但我不断收到此错误:
df <- read_excel("df.xlsx")
chisq.test(df)
Error in chisq.test(df) :
all entries of 'x' must be nonnegative and finite
Study 0 1 2 3 4 5 6 7 8 9 10 11 12
s1 4 6 2 3 1 5 4 0 0 1
s2 3 0 0 20 15 20 12
s3 0 2 2 0 1
s4 0 7 15 4 6 8 5 6 8 0 0 1 5
s5
s6
s7
s8 2 10 20 18 16 6 4 3 0 3
s9 0 9 6 5 2 2
s10