Obtaining sample sizes for a given power comparing two independent proportions in R and G*POWER3
(Taken from Jeremy Miles's e-mail to psych-postgrads)
In R it's much easier and more intuitive (than using the purpose built freeware G*POWER). The command is:
power.prop.test(p1=0.2, p2=0.3, power=0.8)
And it says:
- Two-sample comparison of proportions power calculation
- n = 293.1513
- p1 = 0.2 p2 = 0.3
- sig.level = 0.05
- power = 0.8
- alternative = two.sided
- NOTE: n is number in *each* group
- Two-sample comparison of proportions power calculation
- n = 293.1513
- p1 = 0.2 p2 = 0.3
- sig.level = 0.05
- power = 0.8
- alternative = two.sided
- Two-sample comparison of proportions power calculation
Comparison doing the same calculation to that above in G*POWER 3
The above calculation can also be performed using the chi-square option in the free downloadable software G*POWER3 (or similarly and more straightforwardly using the proportions as inputs, as with R above, choosing exact tests in G*POWER3). Contingency tables are, however, fiddly to power in G*Power3 using the chi-square option. You have to put in the proportions in each of the cells for the alterative and null hypotheses by lcicking on the 'determine' button which opens up a window containing a four by two table of cells which needs probabilties inputting for the null and alternative hypotheses.
If you think your intervention will result in 30% of the participants with capacity compared to a control condition of 20% with capacity, we have the following table assuming equal sized control and intervention groups:
|
Capacity |
No Capacity |
||
Control |
0.20 |
0.80 |
||
Intervention |
0.30 |
0.70 |
whose elements we halve
|
Capacity |
No Capacity |
||
Control |
0.10 |
0.40 |
||
Psychotic Group |
0.15 |
0.35 |
since the probabilities must sum to one.
0.4, 0.1, 0.35, 0.15 goes into
the second column.
Notice the row and column sums of the probabilities for the alternative hypothesis above.
|
Capacity |
No Capacity |
Row sum |
|||
Control |
0.10 |
0.40 |
0.5 |
|||
Psychotic Group |
0.15 |
0.35 |
0.5 |
|||
Column sum |
0.25 |
0.75 |
1 |
Now, under the null hypothesis, we expect the intervention not to make any difference so having the same 20% of people as in our control group with capacity, so we have
|
Capacity |
No Capacity |
Row sum |
|||
Control |
0.125 |
0.375 |
0.5 |
|||
Psychotic Group |
0.125 |
0.375 |
0.5 |
|||
Column sum |
0.25 |
0.75 |
1 |
making sure that the marginals (row and column sums) are the same as those for the alternative hypothesis above which assumed 20% of participants had capacity (before the intervention).
0.375, 0.125, 0.375, 0.125
go into the first column.
Then you can calculate w = 0.115, and with power of 0.8, 1 degree of freedom, you need 589 individuals in total using the calculate button in G*POWER3.