Description Usage Arguments Details Value References See Also Examples
View source: R/descriptive_stats.R
prec_prop
returns the sample size or the precision for the provided
proportion
1 2 3 |
p |
proportion |
n |
number of observations |
conf.width |
precision (the full width of the conficende interval) |
conf.level |
confidence level |
method |
The method to use to calculate precision. Exactly one method may be provided. Methods can be abbreviated. |
tol |
numerical tolerance used in root finding, the default providing (at least) four significant digits |
Exactly one of the parameters n, conf.width
must be passed as NULL,
and that parameter is determined from the other.
The wilson, agresti-coull, exact, and wald method are implemented. The wilson mehtod is suggested for small n (< 40), and the agresti-coull method is suggested for larger n (see reference). The wald method is not suggested, but provided due to its widely distributed use.
uniroot
is used to solve n for the agresti-coull,
wilson, and exact method. Agresti-coull can be abbreviated by ac.
Object of class "presize", a list of arguments (including the
computed one) augmented with method and note elements. In the wilson and
agresti-coull formula, the p from wich the confidence interval is
calculated is adjusted by a term (i.e. p + term \pm ci). This
adjusted p is returned in padj
.
Brown LD, Cai TT, DasGupta A (2001) Interval Estimation for a Binomial Proportion, Statistical Science, 16:2, 101-117, doi:10.1214/ss/1009213286
binom.test
, binom.confint
in package binom, and binconf
in package
Hmisc
1 | prec_prop(p = 1:9 / 10, n = 1:2 * 100, method = "wilson")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.