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

    Function tost

    • Two one-sided t tests (TOST) of equivalence of two means. Equivalent to equivalence::tost() in R.

      Equivalence, |mean(x) - mean(y)| < epsilon, is shown at level alpha = 1 - confLevel when both one-sided t tests of H01: d <= -epsilon and H02: d >= epsilon reject; the p-value is the larger of their p-values and confInt the dual 1 - 2 alpha interval (90% for the default confLevel 0.95). The difference, standard error and degrees of freedom are those of tTest (Welch's by default, pooled with varEqual, paired with paired), with tTest's checks and errors. Used on 0/1 data it compares two proportions with a t approximation; for counts binomDiffEquivalenceTest is the better test.

      Unlike R, a level of 0.5 or less (confLevel) or of 0.5 or more (alpha) is an error (the interval would be empty), and so is a margin that is not positive.

      Parameters

      Returns TostResult

      See TostResult.

      RangeError for a margin that is not positive and finite or a level out of range; Error where tTest has too few observations or the data are essentially constant.

      const r = tost([5.1, 4.9, 5.6, 5.8, 6.0, 5.4], [5.3, 5.0, 5.5, 5.7, 5.9, 5.2], { epsilon: 0.5 });
      r.pValue; // 0.029694342816029128
      r.confInt; // [-0.36394177233776226, 0.4306084390044287] (a 90% interval)
      r.result; // "rejected"