Session Ready
Exercise

Power & Sample Size Calculations

One key part of designing an experiment is knowing the required sample size you'll need to be able to test your hypothesis.

The pwr package provides a handy function, pwr.t.test(), which will calculate that for you. However, you do need to know your desired significance level (often 0.05), if the test is one- or two-sided, if the data is from one sample, two samples, or paired, the effect size, and the power. Some of this information will be given to you or can be reasoned from the design.

A power or sample size calculation is usually different each time you conduct one, and the details of the calculation strongly depend on what kind of experiment you're designing and what your end goals are.

Instructions 1/2
undefined XP
  • 1
    • Load the pwr package.
    • Calculate power using an effect size of 0.35, a sample size of 100 in each group, and a significance level of 0.10.
    • 2
      • Calculate the sample size needed with an effect size of 0.25, a significance level of 0.05, and a power of 0.8.