prec_riskratio {presize} | R Documentation |
Sample size or precision for risk ratio
Description
prec_riskratio
returns the risk ratio and the sample size or the
precision for the provided proportions.
Usage
prec_riskratio(
p1,
p2,
n1 = NULL,
r = 1,
conf.width = NULL,
conf.level = 0.95,
method = c("koopman", "katz"),
...
)
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.
Koopman (koopman
) provides an asymptotic score confidence interval
that is always consistent with Pearsons chi-squared test. It is the
recommended interval (Fagerland et al.).
Katz (katz
) use a logarithmic transformation to calculate the
confidence interval. The CI cannot be computed if one of the proportions is
zero. If both proportions are 1, the estimate of the standard error becomes
zero, resulting in a CI of [1, 1].
uniroot
is used to solve n for the katz, and koopman
method.
References
Fagerland MW, Lydersen S, and Laake P (2015). Recommended confidence intervals for two independent binomial proportions, Statistical methods in medical research 24(2):224-254.
Katz D, Baptista J, Azen SP, and Pike MC (1978) Obtaining Confidence Intervals for the Risk Ratio in Cohort Studies, Biometrics 34:469-474.
Koopman PAR (1984) Confidence Intervals for the Ratio of Two Binomial Proportions, Biometrics 40:513-517.
Examples
# Validate function with example in Fagerland et al. (2015), Table 5.
prec_riskratio(p1 = 7/34, p2 = 1/34, n1 = 34, r = 1, met = "katz")
# 7 (0.91 to 54)
prec_riskratio(p1 = 7/34, p2 = 1/34, n1 = 34, r = 1, met = "koopman")
# 7 (1.21 to 43)
# Validate the Koopman method with example in Koopman (1984)
prec_riskratio(p1 = 36/40, p2 = 16/80, n1 = 40, r = 2, met = "koopman")
# 4.5 (2.94 to 7.15)