- Write the statistical model mathematically.
- Generate the sample according to the model with sample size N.
- Fit the model, perform the test, and record the rejection or acceptance of hull hypothesis.
- Repeat step 2 and 3 n (generally I used 5000) times.
- Calculate the power by (# of rejections)/n.
6 If power is too higher, decrease sample size N, repeat 2 - 5. If power is too lower, increase sample size N, repeat 2 - 5.