如果遇到以下问题,我如何确定是否应该进行 t 检验或卡方检验?
考虑测试与来自两个独立样本,这些样本来自具有未知平均值和以及标准差和的正常群体。是11.4、9.7、11.4、13.3、7.4、8.5、13.4、17.4、12.7 。是3.2、2.7、5.5 、-0.9、-1.8。找出检验统计量的值。
PS:我知道该怎么做chisq.test,t.test当我只有一个假设()!当我有多个假设时,我应该如何编写 R 脚本来解决上述问题?对于这个问题,我可以涵盖哪些与 R 相关的优秀脚本以查看类似的示例?
> X = c( 11.4, 9.7, 11.4, 13.3, 7.4, 8.5, 13.4, 17.4, 12.7)
> Y = c(3.2, 2.7, 5.5, -0.9, -1.8)
> ?t.test
> t.test(X, Y)
Welch Two Sample t-test
data: X and Y
t = 5.9114, df = 8.306, p-value = 0.0003089
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
6.092637 13.805141
sample estimates:
mean of x mean of y
11.68889 1.74000
> chisq.test(X, Y)
Error in chisq.test(X, Y) : 'x' and 'y' must have the same length