3

我想使用 t 统计量在 R 中测试以下假设并计算 p 值:

空假设:mu <= 50

备选:亩> 50

data = c(52.7, 53.9, 41.7, 71.5, 47.6, 55.1,
       62.2, 56.5, 33.4, 61.8, 54.3, 50.0, 
       45.3, 63.4, 53.9, 65.5, 66.6, 70.0,
       52.4, 38.6, 46.1, 44.4, 60.7, 56.4);

这应该很容易,但我不知道该怎么做。感谢您的帮助!

4

2 回答 2

6

如果你H0等于:mu<=50 正确的命令是:

t.test(data, mu=50, alternative = 'greater')

alternative你定义H1。因此它是:H1: mu > 50。输出显示p.value、均值和t-value。就是这样。

于 2013-04-11T12:34:07.710 回答
0

如果问题中的给定条件是正确的,那么我们使用单面测试。IE

t.test(data, alternative= "greater", mu=50) output = One Sample t-test

数据:

data t = 2.1562, df = 23, p-value = 0.02088

备择假设:真实均值大于 50 95% 置信区间: 50.88892 Inf 样本估计:x 的均值

54.33333 

conclusion is that in this p- value is less then 0.05 , so we reject null hypothesis. if in altenative hypothesis is not equal to 100, then we use alternative= "two.sided". everything is depend on the condition, sometime in question is already mentioned less or greater.

于 2016-09-21T12:49:11.163 回答