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

    Function blandAltman

    • Bland-Altman analysis of two methods of measurement: the mean difference, the limits of agreement and their confidence intervals. Equivalent to BlandAltmanLeh::bland.altman.stats() in R.

      With d the differences of the complete pairs (pairs with NaN in either sample are dropped), d̄ their mean and s their standard deviation, the limits of agreement are d̄ ± two s. The mean difference has the t interval d̄ ± t s/sqrt(n) with t quantiles on n - 1 degrees of freedom. The interval of each limit is, by default, BlandAltmanLeh's limit ± t sqrt(3 s²/n) (Bland and Altman 1986); ciMethod: "exact" gives the exact interval (Carkeet 2015): d̄ + s q/sqrt(n) for the upper limit with q the quantiles (1 ∓ confLevel)/2 of the noncentral t distribution with n - 1 degrees of freedom and noncentrality two sqrt(n), and its mirror image for the lower limit.

      Unlike R, fewer than 2 complete pairs, infinite values and a level outside [0, 1] are errors (R gives NA or NaN limits); confLevel 0 gives intervals of width 0 and 1 infinite ones, as R. Identical methods (s = 0) give every limit and interval equal to d̄.

      Parameters

      Returns BlandAltmanResult

      See BlandAltmanResult.

      TypeError if x and y differ in length; RangeError for fewer than 2 complete pairs, infinite values, a two that is not positive and finite, a mode other than 1 or 2, a level outside [0, 1] or an unknown ciMethod.

      const x = [10.1, 12.3, 9.8, 15.2, 11.1, 13.4, 14.8, 9.9, 12.0, 16.3];
      const y = [10.6, 12.0, 10.4, 15.9, 11.0, 14.1, 15.3, 10.3, 12.9, 16.8];
      const r = blandAltman(x, y);
      r.meanDiff; // -0.44000000000000006
      [r.lowerLimit, r.upperLimit]; // [-1.1628122854517629, 0.28281228545176262]
      r.upperLimitConfInt; // [-0.17412106328886995, 0.73974563419239514]
      blandAltman(x, y, { ciMethod: "exact" }).upperLimitConfInt; // [-0.011029811389107025, 0.961726537758047]