rStats.js v1.3.0
    Preparing search index...

    Function binomRatioCI

    • Confidence interval for the ratio p1/p2 of two independent proportions x1/n1 and x2/n2 (the risk ratio). Equivalent to DescTools::BinomRatioCI() in R.

      Methods (method): "katz.log" (the default; Katz's log interval, with 0.5 put for a zero count, and n - 0.5 for both counts when both groups are all successes, as DescTools) and "koopman" (Koopman's score interval, also epiR's score interval of the risk ratio), whose limits are the roots of Koopman's statistic to the precision of the doubles. With sides: "left" or "right" only the lower or the upper limit is kept, at the one-sided level confLevel, and the other end is Infinity or 0 (DescTools computes the one-sided level but keeps both limits). With x1 = x2 = 0 the estimate is 0 and the interval [0, Infinity], as DescTools.

      Parameters

      Returns BinomRatioCIResult

      The estimate p1/p2 and the interval; see BinomRatioCIResult.

      RangeError for counts that are not integers with 0 <= x <= n, n > 0, a level outside (0, 1) (at least 0.5 one-sided), or an unknown method or sides.

      binomRatioCI(56, 70, 48, 80).confInt; // [1.076626422763193, 1.6512485112663868]
      binomRatioCI(56, 70, 48, 80, { method: "koopman" }).confInt; // [1.0798215063618983, 1.6708055780191118]