Sample size calculation for comparisons
sample_size_comp( type, n1 = NULL, n2 = NULL, p1 = NULL, p2 = NULL, delta = NULL, sd = NULL, conf_lev = NULL, power = NULL, ratio = 1, alternative = "two.sided" )
type | Choose "mean" or "proportion" |
---|---|
n1 | Sample size for group 1 |
n2 | Sample size for group 2 |
p1 | Proportion 1 (only used when "proportion" is selected) |
p2 | Proportion 2 (only used when "proportion" is selected) |
delta | Difference in means between two groups (only used when "mean" is selected) |
sd | Standard deviation (only used when "mean" is selected) |
conf_lev | Confidence level |
power | Power |
ratio | Sampling ratio (n1 / n2) |
alternative | Two or one sided test |
A list of variables defined in sample_size_comp as an object of class sample_size_comp
See https://radiant-rstats.github.io/docs/design/sample_size_comp.html for an example in Radiant
summary.sample_size_comp
to summarize results
sample_size_comp( type = "proportion", p1 = 0.1, p2 = 0.15, conf_lev = 0.95, power = 0.8 )#> $res #> #> Difference of proportion power calculation for binomial distribution (arcsine transformation) #> #> h = 0.1518977 #> n = 680.3527 #> sig.level = 0.05 #> power = 0.8 #> alternative = two.sided #> #> NOTE: same sample sizes #> #> #> $backout.ES.h #> function (h, p) #> { #> sort(c(sin((h - 2 * asin(sqrt(p)))/2)^2, sin((-h - 2 * asin(sqrt(p)))/2)^2), #> decreasing = TRUE) #> } #> <bytecode: 0xb22abb8> #> <environment: 0x6a2e548> #> #> $nr_null #> [1] 1 #> #> $adj #> [1] 2 #> #> $sig.level #> [1] 0.05 #> #> $type #> [1] "proportion" #> #> $n1 #> [1] 680.3527 #> #> $n2 #> [1] 680.3527 #> #> $p1 #> [1] 0.1 #> #> $p2 #> [1] 0.15 #> #> $delta #> NULL #> #> $sd #> NULL #> #> $conf_lev #> [1] 0.95 #> #> $power #> [1] 0.8 #> #> $ratio #> [1] 1 #> #> $alternative #> [1] "two.sided" #> #> attr(,"class") #> [1] "sample_size_comp" "list"