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

    Function moodTest

    • Mood's two-sample test of scale. Equivalent to R's mood.test(). NaN values are dropped; ties get the average of the scores of their positions.

      There is also a formula form, moodTest("y ~ g", data, options) (next overload).

      Parameters

      Returns HTest

      const r = moodTest([0.8, 1.9, 2.4, 3.1, 4.6, 5.0], [2.6, 2.9, 3.0, 3.3, 3.5]);
      r.statistic; // 2.0919054414739633
      r.pValue; // 0.03644697523591335
    • Mood's test from a formula and a data frame. As R's mood.test(formula, data): "y ~ g" compares the two levels of g (the first level is x). Only the variables of the formula count: the rows where one of them is missing are dropped.

      Parameters

      • formula: string

        "y ~ g".

      • data: DataFrame

        The data frame: an object of columns (null or NaN for a missing value).

      • Optionaloptions: MoodTestOptions

      Returns HTest