Confidence Intervals

Proportions

One proportion

P = n / x

where n - number of outcomes; x - number of observations.

Absolute risk difference

Diff(𝛿) = P₁ - P₂ = n₁ / x₁ - n₂ / x₂

Risk Ratio

RR = P₁ / P₂ = (n₁ / x₁) - (n₂ / x₂)

Odd Ratio

OR = (n₁ / (x₁ - n₁)) - (n₂ / (x₂ - n₂))

propci

ClinicalTrialUtilities.propciFunction
propci(x::Int, n::Int; alpha=0.05, method = :default)::ConfInt

Confidence interval for proportion.

Computation methods:

  • :wilson | :default - Wilson's confidence interval (CI) for a single proportion (wilson score);
  • :wilsoncc - Wilson's CI with continuity correction (CC);
  • :cp - Clopper-Pearson exact CI;
  • :soc - SOC: Second-Order corrected CI;
  • :blaker - Blaker exact CI for discrete distributions;
  • :arcsine - Arcsine CI;
  • :wald - Wald CI without CC;
  • :waldcc - Wald CI with CC;
propci(tab::ConTab{2,2}; alpha::Real = 0.05, method::Symbol = :default)

Confidence interval for proportions a / (a + b) and c / (c + d)

diffpropci

ClinicalTrialUtilities.diffpropciFunction
diffpropci(x1::Int, n1::Int, x2::Int, n2::Int;
    alpha::Real = 0.05, method::Symbol = :default)::ConfInt

Confidence interval for proportion difference.

Computation methods:

  • :nhs - Newcombes Hybrid (wilson) Score interval for the difference of proportions;
  • :nhscc - Newcombes Hybrid Score CC;
  • :ac - Agresti-Caffo interval for the difference of proportions;
  • :mn | :default - Method of Mee 1984 with Miettinen and Nurminen modification;
  • :mee | :fm - Mee maximum likelihood method;
  • :wald - Wald CI without CC;
  • :waldcc - Wald CI with CC;

References

  • nhs, nhscc - Newcombe RG (1998), Interval Estimation for the Difference Between Independent Proportions: Comparison of Eleven Methods. Statistics in Medicine 17, 873-890.
  • ac - Agresti A, Caffo B., “Simple and effective confidence intervals for proportions and differences of proportions result from adding two successes and two failures”, American Statistician 54: 280–288 (2000)
  • mn - Miettinen, O. and Nurminen, M. (1985), Comparative analysis of two rates. Statist. Med., 4: 213-226. doi:10.1002/sim.4780040211
  • mee - Mee RW (1984) Confidence bounds for the difference between two probabilities, Biometrics40:1175-1176
  • Brown, L.D., Cai, T.T., and DasGupta, A. Interval estimation for a binomial proportion. Statistical Science, 16(2):101–117, 2001.
  • Farrington, C. P. and Manning, G. (1990), “Test Statistics and Sample Size Formulae for Comparative Binomial Trials with Null Hypothesis of Non-zero Risk Difference or Non-unity Relative Risk,” Statistics in Medicine, 9, 1447–1454
  • Li HQ, Tang ML, Wong WK. Confidence intervals for ratio of two Poisson rates using the methodof variance estimates recovery. Computational Statistics 2014; 29(3-4):869-889
  • Brown, L., Cai, T., & DasGupta, A. (2003). INTERVAL ESTIMATION IN EXPONENTIAL FAMILIES. Statistica Sinica, 13(1), 19-49.
diffpropci(tab::ConTab{2,2}; alpha::Real = 0.05, method::Symbol = :default)::ConfInt

Confidence interval for proportion difference: (a / (a + b)) - (c / (c + d))

rrpropci

ClinicalTrialUtilities.rrpropciFunction
rrpropci(x1::Int, n1::Int, x2::Int, n2::Int; alpha::Real = 0.05,
    method::Symbol = :default)::ConfInt

Confidence interval for relative risk.

Computation methods:

  • :mn | :default - Miettinen-Nurminen Score interval;
  • :cli | :walters - Crude log interval;
  • :li | :katz - Log interval for the risk ratio;
  • :mover - Method of variance estimates recovery;
rrpropci(tab::ConTab{2,2}; alpha::Real = 0.05, method::Symbol = :default)::ConfInt

Confidence interval for relative risk.

orpropci

ClinicalTrialUtilities.orpropciFunction
orpropci(x1::Int, n1::Int, x2::Int, n2::Int; alpha::Real = 0.05,
    method::Symbol = :default)::ConfInt

Confidence interval for odd ratio.

Computation methods:

  • :mn - Miettinen-Nurminen CI (deprecated);
  • :mn2 | :default - Miettinen-Nurminen CI;
  • :woolf - Woolf logit CI;
  • :awoolf | :gart - Adjusted Woolf interval (Gart adjusted logit);
  • :mover - Method of variance estimates recovery;
orpropci(tab::ConTab{2,2}; alpha::Real = 0.05, method::Symbol = :default)::ConfInt

Confidence interval for odd ratio.

Means

meanci

ClinicalTrialUtilities.meanciFunction
meanci(m::Real, σ²::Real, n::Int; alpha::Real = 0.05,
    method=:default)::ConfInt

Confidence interval for mean, where:

m - mean; σ² - variance; n - observation number.

Computation methods:

  • :norm - Normal distribution (default);
  • :tdist - T Distribution.

diffmeanci

ClinicalTrialUtilities.diffmeanciFunction
diffmeanci(m1::Real, σ²1::Real, n1::Real, m2::Real, σ²2::Real, n2::Real;
    alpha::Real = 0.05, method::Symbol = :default)::ConfInt

Confidence interval for mead difference.

m1, m2 - mean; σ²1, σ²2 - variance; n1, n2 - observation number.

Computation methods:

  • :ev - equal variance (default);
  • :uv - unequal variance with Welch-Satterthwaite df correction.

Cochran–Mantel–Haenszel confidence intervals

Table cell map:

groupoutcome 1outcome 2
group 1ab
group 2cd

diffcmhci

ClinicalTrialUtilities.diffcmhciFunction
diffcmhci(data; a = :a, b = :b, c = :c, d = :d,
    alpha = 0.05, method = :default)::ConfInt

Cochran–Mantel–Haenszel confidence intervals for proportion difference.

data- data with 4 columns, each line represent 2X2 table

abcd - data table names (number of subjects in 2X2 table):

diffcmhci(a::Vector, b::Vector, c::Vector, d::Vector;
    alpha = 0.05, method = :default)::ConfInt

Cochran–Mantel–Haenszel confidence intervals for proportion difference.

abcd - vector of cells in in 2X2 tables:

orcmhci

ClinicalTrialUtilities.orcmhciFunction
orcmhci(data; a = :a, b = :b, c = :c, d = :d,
    alpha = 0.05, logscale = false)::ConfInt

Cochran–Mantel–Haenszel confidence intervals for odd ratio.

rrcmhci

ClinicalTrialUtilities.rrcmhciFunction
rrcmhci(data; a = :a, b = :b, c = :c, d = :d,
    alpha = 0.05, logscale = false)::ConfInt

Cochran–Mantel–Haenszel confidence intervals for risk ratio.