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

    Function lblTest

    • Asymptotic linear-by-linear association test of a table of two ordered classifications (the Mantel test of trend). Equivalent to coin::lbl_test() in R. As coin's asymptotic test, except for tables with a two-level factor.

      Z = sqrt(N - 1) r, r the Pearson correlation of the row and column scores over the N observations: the linear statistic sum x_ij u_i v_j standardised by its permutation (conditional) mean and variance. The scores are 1..k by default for every factor (the level index; empty rows and columns keep their place). coin leaves a two-level factor unordered and codes it by an indicator of its first level, which turns the sign of Z, and refuses 2 x 2 tables; here two-level factors are scored like the others and a 2 x 2 table is tested (Z^2 is then the 'N - 1' chi-squared statistic). p-values from the normal distribution: "greater" is positive association.

      Parameters

      Returns HTest

      The test result, with statisticName "Z"; see LblTestResult.

      RangeError for negative or non-finite counts, a total of at most 1, scores of the wrong length or not finite, and tables whose row or column scores do not vary over the observations (Z undefined).

      lblTest([[10, 5, 2], [3, 8, 6], [1, 4, 9]]).statistic; // 3.601652214003794