def true_skill_v(mean_delta, draw_margin, c): team_performance_difference = mean_delta / c draw_margin = draw_margin / c denominator = gaussian.cdf(team_performance_difference - draw_margin) if denominator < 1e-161: return -team_performance_difference + draw_margin return gaussian.at(team_performance_difference - draw_margin) / denominator
def true_skill_w(mean_delta, draw_margin, c): team_performance_difference = mean_delta / c draw_margin = draw_margin / c denominator = gaussian.cdf(team_performance_difference - draw_margin) if denominator < 1e-161: if team_performance_difference < 0.0: return 1 return 0 v_win = true_skill_v(mean_delta*c, draw_margin*c, c) return v_win * (v_win + team_performance_difference - draw_margin)
def true_skill_w(mean_delta, draw_margin, c): team_performance_difference = mean_delta / c draw_margin = draw_margin / c denominator = gaussian.cdf(team_performance_difference - draw_margin) if denominator < 1e-161: if team_performance_difference < 0.0: return 1 return 0 v_win = true_skill_v(mean_delta * c, draw_margin * c, c) return v_win * (v_win + team_performance_difference - draw_margin)
import stdio import gaussian #----------------------------------------------------------------------- # Accept a mean and standard deviation as command-line arguments. # Write to standard output a table of the percentage of students # scoring below certain scores on the SAT, assuming the test scores # obey a Gaussian distribution with the given mean and standard # deviation. mu = float(sys.argv[1]) sigma = float(sys.argv[2]) for score in range(400, 1600+1, 100): percent = gaussian.cdf(score, mu, sigma) stdio.writef('%4d %.4f\n', score, percent) #----------------------------------------------------------------------- # python gaussiantable.py 1019 209 # 400 0.0015 # 500 0.0065 # 600 0.0225 # 700 0.0635 # 800 0.1474 # 900 0.2845 # 1000 0.4638 # 1100 0.6508 # 1200 0.8068 # 1300 0.9106