Skip to contents

[Experimental]

This function performs sample size computation for testing a given lower confidence interval of one proportion with the using of the Simple Asymptotic(Wald), Wilson score, clopper-pearson and other methods.

Usage

size_ci_one_prop(
  p,
  lr,
  alpha = 0.05,
  interval = c(1, 1e+05),
  tol = 1e-05,
  alternative = c("two.sided", "less", "greater"),
  method = c("simple-asymptotic", "wilson", "wald", "clopper-pearson")
)

Arguments

p

(numeric)
expected criteria of the evaluated assay.

lr

(numeric)
acceptable criteria of the evaluated assay.

alpha

(numeric)
type-I-risk, \(\alpha\).

interval

(numeric)
a numeric vector containing the end-points of the interval to be searched for the root(sample size). The defaults are set to c(1, 100000).

tol

(numeric)
tolerance for searching the root(sample size).

alternative

(string)
string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less".

method

(string)
string specifying the which method to use. Simple Asymptotic is default, equal to Wald. Options can be "wilson", "clopper-pearson" and other method, see DescTools::BinomCIn

Value

an object of size class that contains the sample size and relevant parameters.

References

Newcombe, R. G. 1998. 'Two-Sided Confidence Intervals for the Single Proportion: Comparison of Seven Methods.' Statistics in Medicine, 17, pp. 857-872.

Examples

size_ci_one_prop(p = 0.85, lr = 0.8, alpha = 0.05, method = "wilson")
#> 
#>  Sample size determination for a Given Lower Confidence Interval 
#> 
#>  Call: size_ci_one_prop(p = 0.85, lr = 0.8, alpha = 0.05, method = "wilson")
#> 
#>    optimal sample size: n = 246 
#> 
#>    p:0.85 lr:0.8 alpha:0.05 interval:c(1, 1e+05) tol:1e-05 alternative:two.sided method:wilson
size_ci_one_prop(p = 0.85, lr = 0.8, alpha = 0.05, method = "simple-asymptotic")
#> 
#>  Sample size determination for a Given Lower Confidence Interval 
#> 
#>  Call: size_ci_one_prop(p = 0.85, lr = 0.8, alpha = 0.05, method = "simple-asymptotic")
#> 
#>    optimal sample size: n = 196 
#> 
#>    p:0.85 lr:0.8 alpha:0.05 interval:c(1, 1e+05) tol:1e-05 alternative:two.sided method:simple-asymptotic
size_ci_one_prop(p = 0.85, lr = 0.8, alpha = 0.05, method = "wald")
#> 
#>  Sample size determination for a Given Lower Confidence Interval 
#> 
#>  Call: size_ci_one_prop(p = 0.85, lr = 0.8, alpha = 0.05, method = "wald")
#> 
#>    optimal sample size: n = 196 
#> 
#>    p:0.85 lr:0.8 alpha:0.05 interval:c(1, 1e+05) tol:1e-05 alternative:two.sided method:wald