Skip to content

Instantly share code, notes, and snippets.

@eliorc
eliorc / permutation_t_test.py
Last active January 14, 2019 15:07
Permutation T-test (statistical)
import numpy as np
from scipy import stats
def permutation_t_test(sample1: list, sample2: list, n: int =10000) -> float:
"""
Conduct a permutation T-test using n iterations and p-value. The higher the p-value, the more likely that sample1
and sample2 are sampled from the same distribution
:param sample1: Sample of continuous observations