Created
December 5, 2011 04:18
-
-
Save zackmdavis/1432280 to your computer and use it in GitHub Desktop.
Not-firstbornness vs. number of siblings
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
from scipy.stats import pearsonr | |
from random import choice | |
def experiment(max_family_size, trials_per_family_size): | |
number_of_sibs = [] | |
not_firstborn = [] | |
for num_sibs in range(1,max_family_size+1): | |
for subject in range(trials_per_family_size): | |
birthrank = choice(range(num_sibs)) | |
number_of_sibs.append(num_sibs) | |
if birthrank == 0: | |
not_firstborn.append(0) | |
else: | |
not_firstborn.append(1) | |
return pearsonr(number_of_sibs, not_firstborn) | |
for i in range(2,51): | |
print i, experiment(i,10000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment