Session Ready
Exercise

Comparing two means for paired samples (3)

Now that we know how to calculate our test parameter \(\bar{x}_{diff}\) and to calculate its standard error, we can test where the difference between the pre diet weight and post diet weights are significant. We are going to do this this test two times. The first time we'll do the test by doing a lot of manual work. The second time, we will do the test by using R's built-in t.test() function.

Instructions
100 XP
  • In the current exercise, our weight dataframe is once again available in your console. We have also made the variables x_diff, std and se available that you calculated in the previous exercise.
  • Calculate the degrees of freedom (n - 1) against which we are testing and store it in the variable df
  • Calculate the t value and store it in a variable called t_value
  • Calculate the p value under the assumption that we are doing a two-sided hypothesis test and store it in a variable called p_value
  • Print the variable p_value to the console.