Hypothesis tests

ttest_ind on two city means.

ttest_ind asks whether two city means differ. Print statistic and pvalue. Tiny n is a demo, not a paper.

Goal

Compare Nairobi vs Mombasa sample temps.

from scipy import stats
nairobi = np.array([22.0, 23, 21, 24, 22])
mombasa = np.array([29.0, 30, 28, 31, 30])
print(stats.ttest_ind(nairobi, mombasa))
from scipy import stats
a = np.array([80.0, 60, 110, 90])
b = np.array([40.0, 20, 50, 35])
print(stats.ttest_ind(a, b).pvalue)
from scipy import stats
print(stats.wilcoxon([1, 2, 3, 4], [2, 2, 4, 5]))
from scipy import stats
print(stats.chisquare([12, 9, 3], f_exp=[8, 8, 8]))