在R中,可以通过使用以下方法来执行双样本单侧t检验:
在Python世界中,
因此,我的问题是是否有人知道如何使用
> A = c(0.19826790, 1.36836629, 1.37950911, 1.46951540, 1.48197798, 0.07532846)
> B = c(0.6383447, 0.5271385, 1.7721380, 1.7817880)
> t.test(A, B, alternative="greater")
Welch Two Sample t-test
data: A and B
t = -0.4189, df = 6.409, p-value = 0.6555
alternative hypothesis: true difference in means is greater than 0
95 percent confidence interval:
-1.029916 Inf
sample estimates:
mean of x mean of y
0.9954942 1.1798523
在Python世界中,
scipy
提供了类似的功能ttest_ind,但只能进行双尾t检验。我发现关于这个主题最接近的信息是这个链接,但它似乎更多地是关于在scipy
中实现单尾与双尾的政策讨论。因此,我的问题是是否有人知道如何使用
numpy/scipy
执行单尾版本的测试的示例或说明?
scipy
版本1.6.0
开始,在scipy.stats.ttest_ind
中进行单侧 t 检验现在成为一个参数。现在您可以更改alternative
参数。 - MattR