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

    Function binomDiffEquivalenceTest

    • Test of equivalence of two independent proportions x1/n1 and x2/n2 within a margin. Two one-sided tests of H01: p1 - p2 <= -margin and H02: p1 - p2 >= margin, each at level alpha; equivalence is shown when both reject. Not an R function. (The R packages in scope give the dual intervals, DescTools::BinomDiffCI, or test one bound at a time.)

      The statistic at a bound delta0 is z = (p1 - p2 - delta0) / sqrt(var), with var the variance of p1 - p2 at the maximum likelihood estimate of (p1, p2) under p1 - p2 = delta0 (Farrington and Manning 1990, "mee"), the same times N/(N - 1) (Miettinen and Nurminen 1985, "mn", the default), or at the observed proportions ("wald"). The p-values are normal tails. The test is dual to binomDiffCI with the same method at the level 1 - 2 alpha: equivalence is shown exactly when that interval, returned as confInt, lies inside (-margin, margin).

      The Wald variance is 0 when both proportions are 0 or 1: the statistics are then infinite and the p-values 0 or 1, as binomDiffCI's Wald interval is a point there.

      Parameters

      Returns BinomDiffEquivalenceTestResult

      See BinomDiffEquivalenceTestResult.

      RangeError for counts that are not integers with 0 <= x <= n, n > 0, a margin outside (0, 1), alpha outside (0, 0.5), or an unknown method.

      const r = binomDiffEquivalenceTest(80, 100, 78, 100, { margin: 0.15 });
      r.pValues; // [0.0018937433499954864, 0.012899725361675841]
      r.pValue; // 0.012899725361675841
      r.confInt; // [-0.07557697533608577, 0.11553638647686569] (binomDiffCI, method "mn", 90%)
      r.result; // "rejected"