Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- import scipy.stats
- plt.close('all')
- mu = 1461 # taken from Bilalic et al.: "Why are (the best) women so good at chess? Participation rates and gender differences in intellectual domains", fig. 1
- sigma = 342
- nu = 10 # degrees of freedom for t-distribution
- G = scipy.stats.norm(mu, sigma) # normal distribution
- T = scipy.stats.t(nu, mu, sigma) # t-distribution
- x = np.linspace(0,3000,1000)
- plt.figure()
- plt.plot(x,G.pdf(x))
- plt.plot(x,T.pdf(x))
- plt.xlabel('ELO rating')
- plt.ylabel('likelihood')
- plt.legend(['Gaussian distribution', 't-distribution '+str(nu)+' dof']); plt.grid()
- # survival function of a 3.5 sigma event
- p_eg = G.sf(mu+3.5*sigma) # probability of event when gaussian
- p_eng = T.sf(mu+3.5*sigma) # probability of event when not gaussian
- p_g = np.array([0.5,0.7,0.8,0.9,0.95,0.98,1]) # prior probabilites for Gaussianity
- result = (p_g*p_eg) / (p_g*p_eg+(1-p_g)*p_eng)
- plt.figure()
- plt.plot(p_g,result,'*-')
- plt.plot([0.5,1],[0.5,0.5],'r--')
- plt.xlabel('prior probability that data is Gaussian')
- plt.ylabel('P(Gaussian | 3.5 sigma event)')
- plt.title('Probability that data is Gaussian conditional on observing a 3.5 sigma event\n(eqivalent to an ELO-rating of 2685))'); plt.grid()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement