0
$\begingroup$

I've seen in R-programming a pwr package (full disclosure, I don't know how to code or program).

I was wondering if there is a formula and if possible a link to its derivation that lets you calculate the appropriate value of any one of $\alpha$, $n$, or power given the other two.

Thanks

$\endgroup$
1
$\begingroup$

The formula depends on what test you're talking about. For some simple tests there is an explicit formula--what you just described is exactly what pwr does for a few of those cases.

In many cases an explicit formula doesn't exist, so you have to estimate power by simulating from the model and conducting the test on the simulated data, and seeing what % of the time the null hypothesis is rejected, which is an estimate of the power. The larger the number of simulation replications, the more accurate that power estimate is. The typical inputs to such simulations are the sample size and the $\alpha$ level. If you are trying to solve for what $n$ is required to get, for example, 80% power, you usually have a try a bunch of different values and determine where the power crossed 80%. The logic there is similar to root-finding algorithms like bisection.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.