% Number of children with parents in different IQ classes f=[54 40 19 29 19 5 5 7 19 22 44 27 10 2 11 12 48 107 78 39 11 16 40 94 186 166 100 17 1 22 60 167 143 77 17 10 0 20 62 58 28 11 0 5 2 26 15 16 19]; class=[0 74; 75 84; 85 94; 95 105; 106 115; 116 125; 126 200]; % How many people are statistically in each class? C=cdf('norm',class(:,2),100,15) pop=[C(1); diff(C)] % Fertility rate for mothers (I got the names flipped for the variables) Pchildmale = sum(f)/sum(f(:)); Pchildmale = Pchildmale./pop' % fertility ratefor fathers Pchildfemale = sum(f')/sum(f(:)); Pchildfemale = Pchildfemale./pop' clf plot(Pchildmale) hold on plot(Pchildfemale,'r') axis([1 7 0 2.2]) ylabel('Normalized probability of children') set(gca,'XTickLabel',{'-74', '75-84', '85-94', '95-105', '106-115', '116-125', '126+'}); legend('Mother IQ','Father IQ') xlabel('IQ') % Estimated fitness function Pchild=[0 0 Pchildmale+Pchildfemale 0]; Cclass=[0; 60; 74; (75+84)/2; (85+94)/2; (95+105)/2; (106+115)/2; (116+125)/2; 126; 200]';