Created
June 7, 2017 14:55
-
-
Save tomachalek/fade97b5fdeaa3fadcfb54c54a42aa7f to your computer and use it in GitHub Desktop.
Generate critical values for F-distribution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scipy.stats | |
import json | |
import sys | |
df_vals = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 15, 20, 24, 30, 40, 60, 120, 1000] | |
def calc(alpha): | |
ans = [] | |
for df1 in df_vals: | |
tmp = [] | |
ans.append(tmp) | |
for df2 in df_vals: | |
tmp.append(round(scipy.stats.f.ppf(1 - alpha, df1, df2), 4)) | |
return ans | |
if __name__ == '__main__': | |
d = { | |
'0.1':calc(0.1), | |
'0.05':calc(0.05), | |
'0.01':calc(0.01) | |
} | |
table = dict(dflist=df_vals, data=d) | |
with open(sys.argv[1], 'wb') as f: | |
json.dump(table, f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment