Last active
December 24, 2018 10:52
-
-
Save mikispag/eae102e4429c85a0a2200413bae28d02 to your computer and use it in GitHub Desktop.
Having two normal distributions with close means (i.e. -0.1, +0.1), points far in the tails over-represent the "closer" bell by a surprising factor. Psychometric tests show that there is 60% chance that a random male is more aggressive than a random female [1], but the top 0.00001% of the population in aggressiveness is all male.
This file contains 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
#!/usr/bin/env python3 | |
from multiprocessing import Pool | |
import scipy.stats | |
N = int(1e10) | |
STDDEV = 1 | |
norm_f = scipy.stats.norm(-0.1, STDDEV) | |
norm_m = scipy.stats.norm(0.1, STDDEV) | |
# 99.993% | 1 in 15787 | |
stddev_4 = 4 * STDDEV | |
# 99.99994% | 1 in 1744278 | |
stddev_5 = 5 * STDDEV | |
# 99.9999962% | 1 in 26330254 | |
stddev_55 = 5.5 * STDDEV | |
# 99.9999998% | 1 in 506797346 | |
stddev_6 = 6 * STDDEV | |
results_4 = { | |
'M': 0, | |
'F': 0 | |
} | |
results_5 = { | |
'M': 0, | |
'F': 0 | |
} | |
results_55 = { | |
'M': 0, | |
'F': 0 | |
} | |
results_6 = { | |
'M': 0, | |
'F': 0 | |
} | |
def generate_scores(): | |
m_4, m_5, m_55, m_6 = 0, 0, 0, 0 | |
f_4, f_5, f_55, f_6 = 0, 0, 0, 0 | |
scores_m = norm_m.rvs(int(1e6)) | |
for score in scores_m: | |
if score > stddev_4: | |
m_4 += 1 | |
if score > stddev_5: | |
m_5 += 1 | |
if score > stddev_55: | |
m_55 += 1 | |
if score > stddev_6: | |
m_6 += 1 | |
scores_f = norm_f.rvs(int(1e6)) | |
for score in scores_f: | |
if score > stddev_4: | |
f_4 += 1 | |
if score > stddev_5: | |
f_5 += 1 | |
if score > stddev_55: | |
f_55 += 1 | |
if score > stddev_6: | |
f_6 += 1 | |
return (m_4, m_5, m_55, m_6, f_4, f_5, f_55, f_6) | |
if __name__ == '__main__': | |
with Pool() as pool: | |
for r in [pool.apply_async(generate_scores) for _ in range(N // int(1e6))]: | |
m_4, m_5, m_55, m_6, f_4, f_5, f_55, f_6 = r.get() | |
results_4['M'] += m_4 | |
results_5['M'] += m_5 | |
results_55['M'] += m_55 | |
results_6['M'] += m_6 | |
results_4['F'] += f_4 | |
results_5['F'] += f_5 | |
results_55['F'] += f_55 | |
results_6['F'] += f_6 | |
print("> µ + 4σ = {}".format(results_4)) | |
print("> µ + 5σ = {}".format(results_5)) | |
print("> µ + 5.5σ = {}".format(results_55)) | |
print("> µ + 6σ = {}".format(results_6)) |
Author
mikispag
commented
Dec 24, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment