power_Binomial {PASSED} | R Documentation |
Power Calculations for Two-Sample Test for Proportions
Description
Compute power of test, or determine parameters to obtain target power for equal and unequal sample sizes.
Usage
power_Binomial(n1 = NULL, n2 = NULL, power = NULL, sig.level = 0.05,
p1 = 0.5, p2 = 0.5, equal.sample = TRUE, alternative = c("two.sided", "one.sided"))
Arguments
n1 |
sample size in group 1, or sample size in each group if equal.sample = TRUE |
n2 |
sample size in group 2 |
power |
power of test (1 minus Type II error probability) |
sig.level |
significance level (Type I error probability) |
p1 |
probability in group 1 |
p2 |
probability in group 2 |
equal.sample |
equal sample sizes for two groups, see details |
alternative |
one- or two-sided test |
Details
Exactly one of the parameters n1
, n2
, p1
, p2
, power
, and sig.level
must be passed as NULL, and that parameter is determined from the others.
Notice that p1
, p2
, sig.level
have non-NULL defaults, so NULL must be explicitly expressed if you want to compute them.
If equal.sample = TRUE
is used, N in output will denote the number in each group.
Value
Object of class "power.htest", a list of the arguments (including the computed one) augmented with note and method elements.
Examples
# calculate power, equal sizes
power_Binomial(n1 = 100, p1 = 0.5, p2 = 0.7)
# calculate power, unequal sizes
power_Binomial(n1 = 150, n2 = 100, p1 = 0.5, p2 = 0.7)
# calculate n2
power_Binomial(n1 = 100, p1 = 0.5, p2 = 0.7, power = 0.9, equal.sample = FALSE)