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

    Function mantelhaenTest

    • Cochran-Mantel-Haenszel chi-squared test of conditional independence in a set of contingency tables, one per stratum. Equivalent to R's mantelhaen.test(). Takes the strata as R takes a three-dimensional array.

      Parameters

      • strata: readonly (readonly (readonly number[])[])[]

        The K strata, each an I x J table of counts as an array of rows (all of the same shape; I, J >= 2, K >= 2 for the asymptotic test).

      • options: MantelhaenTestOptions = {}

      Returns MantelhaenTestResult

      const r = mantelhaenTest([
      [[10, 5], [4, 12]],
      [[8, 6], [5, 9]],
      [[12, 4], [6, 10]],
      ]);
      r.statistic; // 8.972595458903124
      r.pValue; // 0.002740590103473906
      r.estimate; // 4.13218122372723 (common odds ratio)