Sample Size for Testing Confidence Interval of One Proportion
Source:R/samplesize.R
size_ci_one_prop.Rd
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.
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
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