statinfer
    Preparing search index...

    Function correlationTest

    • Tests whether x and y are correlated, using Pearson's r or Spearman's rho.

      Parameters

      Returns TestResult

      const x = [2.1, 3.4, 1.9, 5.6, 4.2, 3.3];
      const y = [1.8, 3.9, 2.2, 5.1, 3.6, 3.5];
      correlationTest({ x, y }); // Pearson
      correlationTest({ x, y, method: "spearman" }); // Spearman, based on ranks