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

    Function ansariTest

    • Ansari-Bradley test that two samples differ in scale. Equivalent to R's ansari.test(). NaN values are dropped.

      With confInt: true, confInt is the interval for the ratio of the scales of x and y and estimate its estimate, both computed with the locations taken as 0 (exact without ties when both samples have fewer than 50 values, otherwise by the normal approximation, whose limits are roots found to a tolerance of 1e-4 as in R). Limits that cannot be formed (the samples differ in location) are NaN. With ties and exact unset or true, R fails ("object 'cint' not found"); rStats.js returns the normal-approximation interval, as with exact: false, and the warnings R gives before it stops.

      Parameters

      Returns HTest

      const r = ansariTest([-2, -1, 1, 2], [-4, -3, 3, 4], { confInt: true });
      r.confInt; // [0.25, 0.6666666666666666]
      r.estimate; // 0.41666666666666663

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

    • Ansari-Bradley test from a formula and a data frame. As R's ansari.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: AnsariTestOptions

      Returns HTest