amazon

1.10.14

Python ftest


Here is an Excel-like ftest of python. (two-sided test)
import numpy as np
import scipy.stats as stats
def ftest(x1, x2):
    dfn = len(x1)-1
    dfd = len(x2)-1
    F = np.var(x1) / np.var(x2)
    f_pf = stats.f.cdf(F, dfn, dfd)
    return min(f_pf, 1 - f_pf)*2

0 件のコメント:

コメントを投稿