Skip to main content
Module

x/simplestatistics/index.js>permutationTest

simple statistics for node & browser javascript
Go to Latest
function permutationTest
import { permutationTest } from "https://deno.land/x/simplestatistics@v7.7.5/index.js";

Conducts a permutation test to determine if two data sets are significantly different from each other, using the difference of means between the groups as the test statistic. The function allows for the following hypotheses:

  • two_tail = Null hypothesis: the two distributions are equal.
  • greater = Null hypothesis: observations from sampleX tend to be smaller than those from sampleY.
  • less = Null hypothesis: observations from sampleX tend to be greater than those from sampleY. Learn more about one-tail vs two-tail tests.

Examples

var control = [2, 5, 3, 6, 7, 2, 5]; var treatment = [20, 5, 13, 12, 7, 2, 2]; permutationTest(control, treatment); // ~0.1324

Parameters

sampleX

first dataset (e.g. treatment data)

sampleY

second dataset (e.g. control data)

alternative

alternative hypothesis, either 'two_sided' (default), 'greater', or 'less'

k

number of values in permutation distribution.

randomSource