In: Statistics and Probability
Here is the data set concerning treatment groups A and B.
57 | 70 |
66 | 27 |
65 | 15 |
40 | 86 |
64 | 49 |
11 | 16 |
34 | 57 |
61 | 29 |
26 | 73 |
45 | 71 |
30 | 98 |
43 | 46 |
64 | 88 |
19 | 22 |
14 | 53 |
14 | 59 |
11 | 94 |
34 | 18 |
68 | 68 |
39 | 62 |
Before performing a t-test to determine if the two groups are different, researchers must first ascertain if the variance in the two groups is the same using an F test.
Indicate whether the hypothesis below is the null or alternate hypothesis for the F test.
"The variance in group A is equal to the variance in group B" _____________? Null/Alternate
Calculate the F statistic for this data set and report it in the box below, rounded to two decimal places. ____________?
Use the formula =(1-(f.dist(F, df1,df2,true) in Excel to calculate the P value for the F statistic, and report it in the box below. Do not use the rounded value for F when calculating the P value. Use the value in the spreadsheet that has not been rounded. __________?
Based on this p value, would you recommend using a Student's t test or a Welch's t test to determine if the two treatment groups have different means? Enter either Student's or Welch's in the box below. ____________?
Using R,
CODE:
a <- fread("57 70
66 27
65 15
40 86
64 49
11 16
34 57
61 29
26 73
45 71
30 98
43 46
64 88
19 22
14 53
14 59
11 94
34 18
68 68
39 62")
names(a) <- c("A","B")
var.test(a$A,a$B,alternative = "two.sided")
OUTPUT:
> a <- fread("57 70
+ 66 27
+ 65 15
+ 40 86
+ 64 49
+ 11 16
+ 34 57
+ 61 29
+ 26 73
+ 45 71
+ 30 98
+ 43 46
+ 64 88
+ 19 22
+ 14 53
+ 14 59
+ 11 94
+ 34 18
+ 68 68
+ 39 62")
> names(a) <- c("A","B")
> var.test(a$A,a$B,alternative = "two.sided")
F test to compare two variances
data: a$A and a$B
F = 0.57577, num df = 19, denom df = 19, p-value =
0.238
alternative hypothesis: true ratio of variances is not equal to 1
95 percent confidence interval:
0.2278986 1.4546665
sample estimates:
ratio of variances
0.5757747
"The variance in group A is equal to the variance in group B" : Null hypothesis.
The value of the F-statistic is 0.58.
P-value is 0.238.
Here p-value is > 0.05. So, we can't reject the null hypothesis that variances are equal at 5% level of significance.
So, as the variances are equal, we use Student's t-test to determine if the two treatment groups have different means.
Student's t-test using R:
CODE:
t.test(a$A,a$B,alternative = "two.sided", var.equal = T)
OUTPUT:
> t.test(a$A,a$B,alternative = "two.sided", var.equal = T)
Two Sample t-test
data: a$A and a$B
t = -1.9691, df = 38, p-value = 0.05626
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-30.0154893 0.4154893
sample estimates:
mean of x mean of y
40.25 55.05
So, the P-value of the t-test is 0.05626 > 0.05. So, we can't reject the null hypothesis that the two means are equal at 5% level of significance,
So, we can conclude that the means are equal.