Session Ready
Exercise

Sample size for comparing means

It is important to recruit an appropriate number of patients into a study. Here we will calculate the sample size needed for a trial that will use a two-sided t-test in the analysis.

A treatment difference of 1 unit with a pooled standard deviation of 3 is expected. If there truly is a treatment difference we want the probability of being able to detect this to be 0.8 (i.e. 80% power).

Instructions
100 XP
  • Use the power.t.test() function to calculate the sample size needed to detect a treatment difference of 1 unit, with standard deviation of 3 and 80% power. Store the results in ss1.
  • Round up and display the numbers needed per group.
  • Use the function to calculate the power given the sample size calculated above.