Skip to content

Instantly share code, notes, and snippets.

@john-adeojo
Last active January 11, 2022 12:45
Show Gist options
  • Save john-adeojo/da6e63e83f0de636bc83368dae4a943d to your computer and use it in GitHub Desktop.
Save john-adeojo/da6e63e83f0de636bc83368dae4a943d to your computer and use it in GitHub Desktop.
from scipy.stats import ks_2samp
# Run a montecarlo simulation over 1,000 turns to get distribution of KS scores for each
def KS_MonteCarlo(euro_league, n_teams, n_seasons):
simulation = np.arange(1,1001,1)
ks_run =[]
for run in simulation:
flat20 = perfect_competition(n_teams, n_seasons).T.to_numpy().flatten()
ks_run.append(ks_2samp(euro_league.Pts, flat20).statistic)
return pd.DataFrame(ks_run)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment