Last active
July 7, 2018 03:31
-
-
Save accessnash/8aceef4344f1adf5b6b3fd52978e4f7c to your computer and use it in GitHub Desktop.
Checking how skew in a chi-squared distribution decreases as the degrees of freedom increases
This file contains hidden or 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 numpy as np | |
| import pandas as pd | |
| import scipy.stats as stat | |
| import matplotlib.pyplot as plt | |
| chi_squared_df1 = np.random.chisquare(1, size = 100000) | |
| chi_squared_df2 = np.random.chisquare(2, size = 100000) | |
| chi_squared_df3 = np.random.chisquare(3, size = 100000) | |
| chi_squared_df4 = np.random.chisquare(4, size = 100000) | |
| chi_squared_df5 = np.random.chisquare(5, size = 100000) | |
| output = plt.hist([chi_squared_df1, chi_squared_df2, chi_squared_df3, chi_squared_df4, chi_squared_df5], bins = 100, histtype = 'step', label = ['1 degree of freedom', '2 degrees of freedom', '3 degrees of freedom', '4 degrees of freedom', '5 degrees of freedom']) | |
| plt.legend(loc = 'upper right') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment