Compute the power of the two-sample test for proportions, or determine parameters to obtain a target power.
1 2 3 4
number of observations (per group)
probability in one group
probability in other group
significance level (Type I error probability)
power of test (1 minus Type II error probability)
one- or two-sided test. Can be abbreviated.
use strict interpretation in two-sided case
numerical tolerance used in root finding, the default providing (at least) four significant digits.
Exactly one of the parameters
sig.level must be passed as NULL, and that
parameter is determined from the others. Notice that
has a non-NULL default so
NULL must be explicitly passed if you
want it computed.
strict = TRUE is used, the power will include the probability of
rejection in the opposite direction of the true effect, in the two-sided
case. Without this the power will be half the significance level if the
true difference is zero.
Note that not all conditions can be satisfied, e.g., for
there is no proportion
p1 = 0.9 and 1, as
you'd need a sample size of at least n = 74 to yield the
desired power for (p1,p2) = (0.9, 1).
For these impossible conditions, currently a warning
warning) is signalled which may become an error
stop) in the future.
Object of class
"power.htest", a list of the arguments
(including the computed one) augmented with
uniroot is used to solve power equation for unknowns, so
you may see errors from it, notably about inability to bracket the
root when invalid arguments are given. If one of
p2 is computed, then p1 < p2 is assumed and will hold,
but if you specify both, p2 <= p1 is allowed.
Peter Dalgaard. Based on previous work by Claus Ekstrøm
1 2 3 4 5 6 7 8 9 10 11 12
power.prop.test(n = 50, p1 = .50, p2 = .75) ## => power = 0.740 power.prop.test(p1 = .50, p2 = .75, power = .90) ## => n = 76.7 power.prop.test(n = 50, p1 = .5, power = .90) ## => p2 = 0.8026 power.prop.test(n = 50, p1 = .5, p2 = 0.9, power = .90, sig.level=NULL) ## => sig.l = 0.00131 power.prop.test(p1 = .5, p2 = 0.501, sig.level=.001, power=0.90) ## => n = 10451937 try( power.prop.test(n=30, p1=0.90, p2=NULL, power=0.8) ) # a warning (which may become an error) ## Reason: power.prop.test( p1=0.90, p2= 1.0, power=0.8) ##-> n = 73.37
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.