prec_riskratio: Sample size or precision for risk ratio

Description Usage Arguments Details References Examples

View source: R/differences.R

Description

prec_riskratio returns the risk ratio and the sample size or the precision for the provided proportions

Usage

1
2
3
prec_riskratio(p1, p2, n1 = NULL, r = 1, conf.width = NULL,
  conf.level = 0.95, method = c("koopman", "katz"),
  tol = .Machine$double.eps^0.25)

Arguments

p1

Risk among unexposed

p2

Risk among exposed

n1

Number of patients in unexposed group

r

allocation ratio (relative size of unexposed and exposed cohort (n1 / n2))

conf.width

precision (the full width of the conficende interval)

conf.level

confidence level

method

Exactly one of koopman (default), katz. Methods can be abbreviated.

tol

numerical tolerance used in root finding, the default providing (at least) four significant digits

Details

Exactly one of the parameters n1, 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

1
2
3
4
5
6
7
8
9
# Validate funciton 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)

a-lenz/presize documentation built on May 17, 2019, 7:44 a.m.