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.
Este ejercicio forma parte del curso
Experimental Design in R
Ejercicio interactivo práctico
Prueba este ejercicio y completa el código de muestra.
# Load the pwr package
___
# Calculate power
pwr.t.test(n = ___,
d = ___,
sig.level = ___,
type = "two.sample",
alternative = "two.sided",
power = NULL)