In: Math
Question:
Test the mean of population X for equality to zero (mu=0)
using the sample x and t-test at a significance level 0.05
set.seed(88)
x <- rt(150,df=2)
> set.seed(88)
> x=rt(150,df=2)
> x
[1] -0.21958221 1.42821188 -0.66493805 2.35173090 -0.26555397
[6] -0.30420180 0.43945338 -0.23427682 -0.45493368
-2.18404620
[11] -2.31755881 0.50838212 -0.49379638 1.31966894 1.13489330
[16] -0.33541249 7.32530628 -0.43908758 -0.46531978
1.94643650
[21] 5.41871649 1.79311459 -0.23981817 2.33358388 1.12051732
[26] 0.93306447 -21.24072291 0.95909053 0.34128047 0.04922479
[31] 2.22389266 0.59921077 -0.28438696 -0.85964985 0.17276497
[36] 0.07353463 -1.45707906 -1.73380005 -0.36397709
1.32216739
[41] 1.41738926 -4.59996740 -0.57090556 -0.51933087
3.83768402
[46] -0.23431069 2.20913214 -1.42266827 -0.83510283
0.01376565
[51] 1.02061158 -1.03769930 1.11520248 -1.14981012
-0.03051753
[56] 0.54459789 0.52101019 -0.40584994 -0.29707884 0.31004454
[61] -1.87351448 -2.17638732 -1.21296658 0.07010182
0.29738718
[66] 1.80251350 -0.33053566 1.29270516 0.14957369 -0.50523791
[71] 1.77126070 -0.69477691 -2.52724053 0.66865711
-2.33735647
[76] -0.90822020 1.69358281 0.20712698 -1.30227823
-0.16013204
[81] -0.30651383 2.92731284 -0.29804983 -3.60658623
0.09544338
[86] 0.45446681 -2.77923575 1.51195080 -0.29533668 5.38681133
[91] 1.53676991 -0.91474536 -7.11922501 -1.03699566
1.37749007
[96] -1.14503468 0.36728612 0.13038706 0.23942099 1.45516926
[101] -0.52735283 0.30606186 2.27047275 -0.47756911
1.60343675
[106] 0.50904273 1.17630908 -1.18108405 -0.43396092
3.12869600
[111] 0.51061040 0.29707283 -0.36962085 -1.05394865
0.52866916
[116] 2.84384059 1.11453076 0.26971028 -1.89402390 0.01928428
[121] -2.38542051 -0.87667573 -0.92802946 -1.00479085
1.41094548
[126] 0.36865606 1.10420485 1.65813672 3.54859768 -0.42637618
[131] 0.10974679 -0.81256825 1.12543211 -0.78540409
0.53502542
[136] 1.17591695 0.39615157 0.66876277 4.73867511 -0.29060777
[141] 0.41732260 1.62750590 -0.91402546 1.35849935
-0.51158476
[146] 1.45289000 3.37342719 -1.26877617 -1.11115598
-0.50359139
> t.test(x)
One Sample t-test
data: x
t = 0.42734, df = 149, p-value = 0.6697
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
-0.3121074 0.4843529
sample estimates:
mean of x
0.08612277
Since p value is greater than alpha= 0.05, hence we accept null hypothesis that population mean is equal to zero.