Power Analysis in R - selmling/Analytics-and-Data-Exploration GitHub Wiki
Power is the probability of rejecting the null hypothesis when it is false (avoiding Type II error -- false hit).
Install pwr
R library to easily run power analyses.
Typically using the pwr.t.test
function from this package which requires the parameters below:
-
d
This is typically the measure of effect size, Cohen's d. Find a paper which is similar in design to your planned design. Do they state effect size in terms of Cohen's d? If they listed a confidence interval for their cohen's d, you can use the lower bound as your d value in your power analysis code. If not, just take the d they list (for the effect that your study aims to most closely resemble in its design.
-
sig.level
This is .05 for psychology.
-
power
Usually set to .80 for psychology.
-
type
"two.sample", "one.sample", or "paired". For contingent vs yoked, it would be paired. For together vs apart, it would be paired.
Here is some example code for using pwr
to generate a desired sample size using power analysis:
library("pwr")
# ---- Piazza et al., 2020
t_power <- pwr.t.test(d = .37,
sig.level = .05,
power = .8,
type = "paired")
t_power