Session Ready
Exercise

Perform an independent t-test (2)

In this exercise, we'll finish computing the observed t-value. Then we will determine the p-value using the relevant t-distribution. If you recall, in the last chapter we calculated the critical value. The p-value is simply an alternative approach to hypothesis testing and determining the significance of your results. It's good to practice both! Finally, we will finish by calculating effect size via Cohen's d.

Recall from the previous exercise, the formula for the t-value is

$$t = \frac{\bar{x_1} - \bar{x_2}}{se_p}$$

where \(\bar{x_1}\) and \(\bar{x_1}\) are the mean intelligence gains for group 1 and group 2, respectively, and \(se_p\) is the pooled standard error.

The formula for Cohen's d for independent t-tests is

$$ d = \frac{\bar{x_1} - \bar{x_2}}{sd_p}$$

where \(sd_p\) is the pooled standard deviation, which in turn is equal to

$$ sd_p = \frac{sd_1 + sd_2}{2} $$

where \(sd_1\) and \(sd_2\) are the standard deviations of the first and second groups, respectively.

Instructions
100 XP
  • Calculate the observed t-value according to the formula above. Use mean_diff and se_pooled, which are still loaded in your workspace from the last exercise, and store the result in t_value.
  • Compute the p-value using pt(). The first argument is the t-value you just computed and the second argument is the degrees of freedom (stored in df from last exercise). We multiply the result by 2 since this is a two-sided hypothesis test.
  • Calculate the standard deviation of the intelligence gain for the 8-day and 19-day training groups using the sd() function.
  • Calculate the pooled standard deviation using the formula outlined above and the objects created in the previous instruction.
  • Calculate cohens_d using the formula provided above. All you need is mean_diff and pooled_sd.