1.3 Carrying out the test: Independent samples \(t\)-test

We are now ready to carry out the independent samples \(t\)-test to test whether the average cholesterol level is different between the two groups. Since the equal variances assumptions has not been violated, we will use the version of the test that assumes equal variances. The results of the test are as follows:


    Two Sample t-test

data:  heartattack$cholesterol by heartattack$risk
t = 7.5483, df = 70, p-value = 1.238e-10
alternative hypothesis: true difference in means between group high and group low is not equal to 0
95 percent confidence interval:
 0.4851270 0.8335547
sample estimates:
mean in group high  mean in group low 
          5.458536           4.799195 

We note the following:

  • The \(p\)-value is almost 0, which is much less than 0.05, so we reject \(H_0\). That is, we have enough evidence to conclude that the difference between groups is statistically significant.
  • The 95% confidence interval for \(\mu_1 - \mu_2\) is (0.49, 0.83), meaning we are 95% confident that the population mean cholesterol level of the high risk group is between 0.49 and 0.83 mmol/L higher than that of the low risk group. Since this interval does not include 0, we can reject \(H_0\). To understand why, recall that \(H_0\) represents the null hypothesis that \(\mu_1 = \mu_2\). If \(\mu_1\) and \(\mu_2\) were equal, the difference between them would be 0. Since we are 95% confident that the true difference between \(\mu_1\) and \(\mu_2\) is between (0.49, 0.83), a range which does not include 0, we have enough evidence to conclude that the difference is statistically significant and we reject \(H_0\).
  • The test statistic is \(t = 7.5483\)
  • The degrees of freedom is 70
  • The sample means are \(5.46\) and \(4.8\) respectively.