# 19.1: Power Analysis

- Page ID
- 8814

We can compute a power analysis using functions from the `pwr`

package. Let’s focus on the power for a t-test in order to determine a difference in the mean between two groups. Let’s say that we think than an effect size of Cohen’s d=0.5 is realistic for the study in question (based on previous research) and would be of scientific interest. We wish to have 80% power to find the effect if it exists. We can compute the sample size needed for adequate power using the `pwr.t.test()`

function:

`pwr.t.test(d=0.5, power=.8)`

```
##
## Two-sample t test power calculation
##
## n = 64
## d = 0.5
## sig.level = 0.05
## power = 0.8
## alternative = two.sided
##
## NOTE: n is number in *each* group
```

Thus, about 64 participants would be needed in each group in order to test the hypothesis with adequate power.