prop_power {catfun} | R Documentation |
Power and sample size for 2 proportions
Description
Calculate power and sample size for comparison of 2 proportions for both balanced and unbalanced designs.
Usage
prop_power(n, n1, n2, p1, p2, fraction = 0.5, alpha = 0.05,
power = NULL, alternative = c("two.sided", "one.sided"), odds.ratio,
percent.reduction, ...)
Arguments
n |
total sample size. |
n1 |
sample size in group 1. |
n2 |
sample size in group 2. |
p1 |
group 1 proportion. |
p2 |
group 2 proportion. |
fraction |
fraction of total observations that are in group 1. |
alpha |
significance level/type 1 error rate. |
power |
desired power, between 0 and 1. |
alternative |
alternative hypothesis, one- or two-sided test. |
odds.ratio |
odds ratio comparing p2 to p2. |
percent.reduction |
percent reduction of p1 to p2. |
... |
further arguments passed to or from other methods. |
Details
Power calculations are done using the methods described in 'stats::power.prop.test', 'Hmisc::bsamsize', and 'Hmisc::bpower'.
Value
a list with class "prop_power" containing the following components:
n |
the total sample size |
n1 |
the sample size in group 1 |
n2 |
the sample size in group 2 |
p1 |
the proportion in group 1 |
p2 |
the proportion in group 2 |
power |
calculated or desired power |
sig.level |
level of significance |
See Also
[stats::power.prop.test], [Hmisc::bsamsize], [Hmisc:bpower]
Examples
prop_power(n = 220, p1 = 0.35, p2 = 0.2)
prop_power(p1 = 0.35, p2 = 0.2, fraction = 2/3, power = 0.85)
prop_power(p1 = 0.35, n = 220, percent.reduction = 42.857)
prop_power(p1 = 0.35, n = 220, odds.ratio = 0.4642857)