In: Statistics and Probability
Suppose we are interested in testing null hypothesis that difference of two population means is the same. Consider two samples collected from a normal population.
x | 4.2 | 4.5 | 4.9 | 5.6 | 5.7 | 5.9 | 6.1 | 6.3 | 6.8 | 7.1 | 7.3 | 7.8 | 8.4 | 8.6 | 9.1 | 9.7 | 10.2 |
y | 5.6 | 5.9 | 6.5 | 7.8 | 8.5 | 9.3 |
We need to testH0:x=yvsHa:x̸=yWe can use R-command t.test to compute the p-value and the confidence interval.> x = c ( 4.2 ,4.5,4.9,5.6,5.7 ,5.9, 6.1, 6.3 , 6.8 , 7.1 , 7.3 ,7.8,8.4,8.6 , 9.1, 9.7, 10.2)#entering data > y = c ( 5.6 ,5.9,6.5,7.8 ,8.5, 9.3)#entering data> x[1] 4.2 4.5 4.9 5.6 5.7 5.9 6.1 6.3 6.8 7.1 7.3 7.8 8.4 8.6 9.1 9.7 10.2> y[1] 5.6 5.9 6.5 7.8 8.5 9.3> t.test(x,y,mu=0,var.equal=F,conf.level=0.95)# Ho:mux
R Output
> x = c ( 4.2 ,4.5,4.9,5.6,5.7 ,5.9, 6.1, 6.3 , 6.8 ,
7.1 , 7.3 ,7.8,8.4,8.6 , 9.1, 9.7, 10.2)
> y = c ( 5.6 ,5.9,6.5,7.8 ,8.5, 9.3)
> t.test(x,y,mu=0,var.equal=F,conf.level=0.95)
Welch Two Sample t-test
data: x and y
t = -0.41807, df = 10.565, p-value = 0.6843
alternative hypothesis: true difference in means is not equal to
0
95 percent confidence interval:
-1.973709 1.346258
sample estimates:
mean of x mean of y
6.952941 7.266667
The following null and alternative hypotheses need to be tested:
Ho: μx =μy
Ha: μx ≠ μy
This corresponds to a two-tailed test.
Since it is assumed that the population variances are unequal, the t-statistic is:
t = -0.41807
Using the P-value approach: The p-value is p-value = 0.6843, and since p-value = 0.6843 > 0.05, it is concluded that the null hypothesis is not rejected. and we conclude that μx =μy
95 percent confidence interval:
-1.973709 1.346258