https://psyteachr.github.io/quant-fun-v2/power-and-effect-sizes.html # Power calculation ![image](https://hackmd.io/_uploads/rykQEQirC.png) ![image](https://hackmd.io/_uploads/Sk002Bn3yx.png) Type I error - or false positive, is the probability of rejecting the null hypothesis when it should not be rejected Type II error - or false negative, is the probability of retaining the null hypothesis when it is false power - correctly concluding there is an effect when there is a real effect to detect, the probability of correctly rejecting the null hypothesis for a given effect size and sample size. ![image](https://hackmd.io/_uploads/H1qFGQjSC.png) Today we will use the functions pwr.t.test(), pwr.r.test() and pwr.chisq.test from the package pwr to run power calculations for t-tests, correlations and chi-square. The pwr package 1. For a t test - use pwr.t.test ![image](https://hackmd.io/_uploads/Byu3ZQoHC.png) ``` pwr.t.test(d = .4, power = .8, sig.level = .05, alternative = "two.sided", type = "two.sample") %>% pluck("n") %>% ceiling() ``` 2. For correlation, use pwr.r.test ![image](https://hackmd.io/_uploads/H1iiMQsSC.png) ![image](https://hackmd.io/_uploads/H1kkEQjH0.png) ![image](https://hackmd.io/_uploads/SJ8eN7oHR.png)