2019-02-28
阅读量:
1704
报错所有条目必须是非负且有限的”
我想知道两个类别之间的转换率是否存在统计上的显着差异。
我的数据看起来像这样
operating_system converted
1 Mac FALSE
2 Mac FALSE
3 Windows FALSE
4 Windows TRUE
5 Windows FALSE
6 Mac TRUE
7 Mac FALSE
8 Windows FALSE
9 Mac FALSE
10 Mac FALSE
我运行了这段代码。
chisq.test(df)
我收到了这个错误。
chisq.test(df)中的错误:'x'的所有条目必须是非负且有限的
解决办法:chisq.test 使用列联表:
df <- data.frame(operating_system = c("Mac", "Mac", "Windows", "Windows", "Windows", "Mac", "Mac", "Windows", "Mac", "Mac"),
converted = c(F, F, F, T, F, T, F, F, F, F), stringsAsFactors = TRUE)
chisq.test(table(df))






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
1条评论