Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Experimental Design in R

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Load the pwr package
___

# Calculate power
pwr.t.test(n = ___, 
           d = ___,
           sig.level = ___,
           type = "two.sample", 
           alternative = "two.sided",
           power = NULL)
Code bewerken en uitvoeren