prec_or {presize} | R Documentation |
Sample size or precision for an odds ratio
Description
prec_or
returns the sample size or the precision for the
provided proportions.
Usage
prec_or(
p1,
p2,
n1 = NULL,
r = 1,
conf.width = NULL,
conf.level = 0.95,
method = c("gart", "woolf", "indip_smooth"),
...
)
Arguments
p1 |
risk among exposed. |
p2 |
risk among unexposed. |
n1 |
number of patients in exposed group. |
r |
allocation ratio (relative size of unexposed and exposed cohort
( |
conf.width |
precision (the full width of the confidence interval). |
conf.level |
confidence level. |
method |
Exactly one of |
... |
other arguments to uniroot (e.g. |
Details
Exactly one of the parameters n1
or conf.width
must be passed as NULL,
and that parameter is determined from the other.
Woolf (woolf
), Gart (gart
), and Independence-smoothed logit
(indip_smooth
) belong to a general family of adjusted confidence
intervals, adding 0 (woolf) to each cell, 0.5 (gart) to each cell, or an
adjustment for each cell based on observed data (independence-smoothed). In
gart and indip_smooth, estimate of the CI is not possible if p1 = 0
, in
which case the OR becomes 0, but the lower level of the CI is > 0. Further,
if p1 = 1
and p2 < 1
, or if p1 > 0
and p2 = 0
, the OR
becomes \infty
, but the upper limit of the CI is finite. For the
approximate intervals, gart
and indip_smooth
are the
recommended intervals (Fagerland et al. 2011).
uniroot
is used to solve n for the woolf, gart, and
indip_smooth method.
Value
Object of class "presize", a list of arguments (including the computed one) augmented with method and note elements.
References
Fagerland MW, Lydersen S, Laake P (2015). Recommended confidence intervals for two independent binomial proportions. Statistical Methods in Medical Research, 24(2):224-254. doi:10.1177/0962280211415469.
Examples
# 10\% events in one group, 15\% in the other, 200 participants total
# (= 100 in each group), estimate confidence interval width
prec_or(p1 = .1, p2 = .15, n1 = 200/2)
# formula by Gart
prec_or(p1 = .1, p2 = .15, n1 = 200/2, method = "gart")
# formula by Woolf
prec_or(p1 = .1, p2 = .15, n1 = 200/2, method = "woolf")
# 10\% odds in one group, 15\% in the other, desired CI width of 0.1,
# estimate N
prec_or(p1 = .1, p2 = .15, conf.width = .1)
# formula by Gart
prec_or(p1 = .1, p2 = .15, conf.width = .1, method = "gart")
# formula by Woolf
prec_or(p1 = .1, p2 = .15, conf.width = .1, method = "woolf")