Skip to content

Instantly share code, notes, and snippets.

@tomachalek
Created June 7, 2017 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomachalek/fade97b5fdeaa3fadcfb54c54a42aa7f to your computer and use it in GitHub Desktop.
Save tomachalek/fade97b5fdeaa3fadcfb54c54a42aa7f to your computer and use it in GitHub Desktop.
Generate critical values for F-distribution
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