====================================================================================================================== HOW OFTEN DOES A GOOD GENE LOSE? Wright-Fisher simulation of fixation probability under genic selection Science Journaling Club, Volume 1 Issue 1, Fall 2024 ====================================================================================================================== This output is generated by simulation. No organism, population or laboratory measurement is involved anywhere in this file. numpy version : 2.4.2 python version : 3.12.3 master seed : 20240917 generator : numpy PCG64, one independent stream per grid cell population sizes N : [50, 200, 1000, 5000, 10000] selection coefficients s : [0.0, 0.001, 0.002, 0.005, 0.01, 0.02, 0.05, 0.1] replicate floor : 50,000 replicate ceiling : 8,000,000 target relative SE : 10% replicate safety factor : 3.0x the count the target alone implies Model, one generation: p' = p(1+s)/(1+sp) then i' ~ Binomial(2N, p'). Start i = 1. Absorb at i = 0 (lost) or i = 2N (fixed). ====================================================================================================================== SECTION 1. GRID OF RUNS ====================================================================================================================== N s 4Ns replicates fixations u_hat SE rel SE gens run sec ---------------------------------------------------------------------------------------------------------------------- 50 0.000 0.0 50,000 475 0.009500 0.000434 4.6% 901 0.0 50 0.001 0.2 50,000 588 0.011760 0.000482 4.1% 627 0.0 50 0.002 0.4 50,000 603 0.012060 0.000488 4.0% 898 0.1 50 0.005 1.0 50,000 801 0.016020 0.000561 3.5% 761 0.0 50 0.010 2.0 50,000 1,128 0.022560 0.000664 2.9% 778 0.1 50 0.020 4.0 50,000 2,007 0.040140 0.000878 2.2% 719 0.1 50 0.050 10.0 50,000 4,738 0.094760 0.001310 1.4% 351 0.1 50 0.100 20.0 50,000 8,733 0.174660 0.001698 1.0% 214 0.1 200 0.000 0.0 119,700 291 0.002431 0.000142 5.9% 2,683 0.2 200 0.001 0.8 82,384 292 0.003544 0.000207 5.8% 3,242 0.1 200 0.002 1.6 59,678 283 0.004742 0.000281 5.9% 3,284 0.1 200 0.005 4.0 50,000 478 0.009560 0.000435 4.6% 2,153 0.1 200 0.010 8.0 50,000 988 0.019760 0.000622 3.1% 1,572 0.1 200 0.020 16.0 50,000 1,933 0.038660 0.000862 2.2% 823 0.1 200 0.050 40.0 50,000 4,697 0.093940 0.001305 1.4% 411 0.1 200 0.100 80.0 50,000 8,818 0.176360 0.001704 1.0% 203 0.1 1000 0.000 0.0 599,700 286 0.000477 0.000028 5.9% 12,625 0.8 1000 0.001 4.0 147,100 285 0.001937 0.000115 5.9% 12,099 0.3 1000 0.002 8.0 74,825 299 0.003996 0.000231 5.8% 6,257 0.2 1000 0.005 20.0 50,000 462 0.009240 0.000428 4.6% 3,056 0.1 1000 0.010 40.0 50,000 996 0.019920 0.000625 3.1% 1,743 0.3 1000 0.020 80.0 50,000 1,988 0.039760 0.000874 2.2% 980 0.4 1000 0.050 200.0 50,000 4,735 0.094700 0.001309 1.4% 437 0.4 1000 0.100 400.0 50,000 8,818 0.176360 0.001704 1.0% 240 0.4 5000 0.000 0.0 2,999,700 316 0.000105 0.000006 5.6% 108,144 17.0 5000 0.001 20.0 149,851 287 0.001915 0.000113 5.9% 17,685 1.8 5000 0.002 40.0 74,851 327 0.004369 0.000241 5.5% 8,654 1.0 5000 0.005 100.0 50,000 502 0.010040 0.000446 4.4% 3,506 0.6 5000 0.010 200.0 50,000 1,007 0.020140 0.000628 3.1% 2,033 0.5 5000 0.020 400.0 50,000 1,973 0.039460 0.000871 2.2% 1,146 0.5 5000 0.050 1000.0 50,000 4,713 0.094260 0.001307 1.4% 554 0.4 5000 0.100 2000.0 50,000 8,783 0.175660 0.001702 1.0% 271 0.2 10000 0.000 0.0 5,999,700 323 0.000054 0.000003 5.6% 167,011 34.5 10000 0.001 40.0 149,851 315 0.002102 0.000118 5.6% 15,569 1.9 10000 0.002 80.0 74,851 313 0.004182 0.000236 5.6% 8,607 1.1 10000 0.005 200.0 50,000 517 0.010340 0.000452 4.4% 3,894 0.7 10000 0.010 400.0 50,000 1,002 0.020040 0.000627 3.1% 2,224 0.5 10000 0.020 800.0 50,000 2,026 0.040520 0.000882 2.2% 1,154 0.5 10000 0.050 2000.0 50,000 4,779 0.095580 0.001315 1.4% 551 0.3 10000 0.100 4000.0 50,000 8,770 0.175400 0.001701 1.0% 287 0.3 ====================================================================================================================== SECTION 2. NEUTRAL CASE AGAINST THE EXACT ANSWER 1/(2N) ====================================================================================================================== For s = 0 the Wright-Fisher chain gives u = 1/(2N) exactly, because the mutant copy number is a martingale and every one of the 2N copies in the founding generation is equally likely to be the ancestor of the whole future population. This is a check on the code, not on the theory. N replicates fixations u_hat SE 95% CI (Wilson) 1/(2N) rel diff z ---------------------------------------------------------------------------------------------------------------------- 50 50,000 475 0.009500 0.000434 [0.008687, 0.010389] 0.010000 -5.00% -1.12 200 119,700 291 0.002431 0.000142 [0.002168, 0.002726] 0.002500 -2.76% -0.48 1000 599,700 286 0.000477 0.000028 [0.000425, 0.000535] 0.000500 -4.62% -0.80 5000 2,999,700 316 0.000105 0.000006 [0.000094, 0.000118] 0.000100 +5.34% +0.93 10000 5,999,700 323 0.000054 0.000003 [0.000048, 0.000060] 0.000050 +7.67% +1.33 Does the 95% interval contain the exact value? N = 50: yes N = 200: yes N = 1000: yes N = 5000: yes N = 10000: yes Largest |z| across the five neutral cells: 1.33 Five independent z scores from a correct simulator should mostly sit inside +/-2. Anything past 3 would mean the code is wrong. ====================================================================================================================== SECTION 3. FULL GRID AGAINST HALDANE AND KIMURA ====================================================================================================================== u_hat our estimate from the replicates 2s Haldane 1927, the large-N branching-process limit Kimura (1 - exp(-2s)) / (1 - exp(-4Ns)), Kimura 1962 d_Hal (u_hat - 2s) / 2s d_Kim (u_hat - Kimura) / Kimura z_Kim (u_hat - Kimura) / SE, how many standard errors out we are N s 4Ns reps fix u_hat SE 2s d_Hal Kimura d_Kim z_Kim ---------------------------------------------------------------------------------------------------------------------- 50 0.000 0.0 50,000 475 0.009500 0.000434 -- -- 0.010000 -5.0% -1.15 50 0.001 0.2 50,000 588 0.011760 0.000482 0.002000 +488.0% 0.011022 +6.7% +1.53 50 0.002 0.4 50,000 603 0.012060 0.000488 0.004000 +201.5% 0.012109 -0.4% -0.10 50 0.005 1.0 50,000 801 0.016020 0.000561 0.010000 +60.2% 0.015741 +1.8% +0.50 50 0.010 2.0 50,000 1,128 0.022560 0.000664 0.020000 +12.8% 0.022901 -1.5% -0.51 50 0.020 4.0 50,000 2,007 0.040140 0.000878 0.040000 +0.4% 0.039942 +0.5% +0.23 50 0.050 10.0 50,000 4,738 0.094760 0.001310 0.100000 -5.2% 0.095167 -0.4% -0.31 50 0.100 20.0 50,000 8,733 0.174660 0.001698 0.200000 -12.7% 0.181269 -3.6% -3.89 ...................................................................................................................... 200 0.000 0.0 119,700 291 0.002431 0.000142 -- -- 0.002500 -2.8% -0.48 200 0.001 0.8 82,384 292 0.003544 0.000207 0.002000 +77.2% 0.003628 -2.3% -0.41 200 0.002 1.6 59,678 283 0.004742 0.000281 0.004000 +18.6% 0.005002 -5.2% -0.92 200 0.005 4.0 50,000 478 0.009560 0.000435 0.010000 -4.4% 0.010136 -5.7% -1.32 200 0.010 8.0 50,000 988 0.019760 0.000622 0.020000 -1.2% 0.019808 -0.2% -0.08 200 0.020 16.0 50,000 1,933 0.038660 0.000862 0.040000 -3.4% 0.039211 -1.4% -0.64 200 0.050 40.0 50,000 4,697 0.093940 0.001305 0.100000 -6.1% 0.095163 -1.3% -0.94 200 0.100 80.0 50,000 8,818 0.176360 0.001704 0.200000 -11.8% 0.181269 -2.7% -2.88 ...................................................................................................................... 1000 0.000 0.0 599,700 286 0.000477 0.000028 -- -- 0.000500 -4.6% -0.82 1000 0.001 4.0 147,100 285 0.001937 0.000115 0.002000 -3.1% 0.002035 -4.8% -0.85 1000 0.002 8.0 74,825 299 0.003996 0.000231 0.004000 -0.1% 0.003993 +0.1% +0.01 1000 0.005 20.0 50,000 462 0.009240 0.000428 0.010000 -7.6% 0.009950 -7.1% -1.66 1000 0.010 40.0 50,000 996 0.019920 0.000625 0.020000 -0.4% 0.019801 +0.6% +0.19 1000 0.020 80.0 50,000 1,988 0.039760 0.000874 0.040000 -0.6% 0.039211 +1.4% +0.63 1000 0.050 200.0 50,000 4,735 0.094700 0.001309 0.100000 -5.3% 0.095163 -0.5% -0.35 1000 0.100 400.0 50,000 8,818 0.176360 0.001704 0.200000 -11.8% 0.181269 -2.7% -2.88 ...................................................................................................................... 5000 0.000 0.0 2,999,700 316 0.000105 0.000006 -- -- 0.000100 +5.3% +0.90 5000 0.001 20.0 149,851 287 0.001915 0.000113 0.002000 -4.2% 0.001998 -4.1% -0.73 5000 0.002 40.0 74,851 327 0.004369 0.000241 0.004000 +9.2% 0.003992 +9.4% +1.56 5000 0.005 100.0 50,000 502 0.010040 0.000446 0.010000 +0.4% 0.009950 +0.9% +0.20 5000 0.010 200.0 50,000 1,007 0.020140 0.000628 0.020000 +0.7% 0.019801 +1.7% +0.54 5000 0.020 400.0 50,000 1,973 0.039460 0.000871 0.040000 -1.3% 0.039211 +0.6% +0.29 5000 0.050 1000.0 50,000 4,713 0.094260 0.001307 0.100000 -5.7% 0.095163 -0.9% -0.69 5000 0.100 2000.0 50,000 8,783 0.175660 0.001702 0.200000 -12.2% 0.181269 -3.1% -3.30 ...................................................................................................................... 10000 0.000 0.0 5,999,700 323 0.000054 0.000003 -- -- 0.000050 +7.7% +1.28 10000 0.001 40.0 149,851 315 0.002102 0.000118 0.002000 +5.1% 0.001998 +5.2% +0.88 10000 0.002 80.0 74,851 313 0.004182 0.000236 0.004000 +4.5% 0.003992 +4.8% +0.80 10000 0.005 200.0 50,000 517 0.010340 0.000452 0.010000 +3.4% 0.009950 +3.9% +0.86 10000 0.010 400.0 50,000 1,002 0.020040 0.000627 0.020000 +0.2% 0.019801 +1.2% +0.38 10000 0.020 800.0 50,000 2,026 0.040520 0.000882 0.040000 +1.3% 0.039211 +3.3% +1.48 10000 0.050 2000.0 50,000 4,779 0.095580 0.001315 0.100000 -4.4% 0.095163 +0.4% +0.32 10000 0.100 4000.0 50,000 8,770 0.175400 0.001701 0.200000 -12.3% 0.181269 -3.2% -3.45 ...................................................................................................................... ====================================================================================================================== SECTION 4. WHERE THE APPROXIMATIONS BREAK DOWN ====================================================================================================================== Haldane's 2s assumes the mutant never feels the ceiling: an infinite population in which a lineage either dies out early or escapes for good. Kimura's diffusion keeps the ceiling and so keeps N. Haldane's error, sorted by 4Ns, positive s only: 4Ns N s u_hat 2s d_Hal Kimura d_Kim ---------------------------------------------------------------------------------------------------------------------- 0.2 50 0.001 0.011760 0.002000 +488.0% 0.011022 +6.7% 0.4 50 0.002 0.012060 0.004000 +201.5% 0.012109 -0.4% 0.8 200 0.001 0.003544 0.002000 +77.2% 0.003628 -2.3% 1.0 50 0.005 0.016020 0.010000 +60.2% 0.015741 +1.8% 1.6 200 0.002 0.004742 0.004000 +18.6% 0.005002 -5.2% 2.0 50 0.010 0.022560 0.020000 +12.8% 0.022901 -1.5% 4.0 50 0.020 0.040140 0.040000 +0.4% 0.039942 +0.5% 4.0 200 0.005 0.009560 0.010000 -4.4% 0.010136 -5.7% 4.0 1000 0.001 0.001937 0.002000 -3.1% 0.002035 -4.8% 8.0 200 0.010 0.019760 0.020000 -1.2% 0.019808 -0.2% 8.0 1000 0.002 0.003996 0.004000 -0.1% 0.003993 +0.1% 10.0 50 0.050 0.094760 0.100000 -5.2% 0.095167 -0.4% 16.0 200 0.020 0.038660 0.040000 -3.4% 0.039211 -1.4% 20.0 50 0.100 0.174660 0.200000 -12.7% 0.181269 -3.6% 20.0 1000 0.005 0.009240 0.010000 -7.6% 0.009950 -7.1% 20.0 5000 0.001 0.001915 0.002000 -4.2% 0.001998 -4.1% 40.0 200 0.050 0.093940 0.100000 -6.1% 0.095163 -1.3% 40.0 1000 0.010 0.019920 0.020000 -0.4% 0.019801 +0.6% 40.0 5000 0.002 0.004369 0.004000 +9.2% 0.003992 +9.4% 40.0 10000 0.001 0.002102 0.002000 +5.1% 0.001998 +5.2% 80.0 200 0.100 0.176360 0.200000 -11.8% 0.181269 -2.7% 80.0 1000 0.020 0.039760 0.040000 -0.6% 0.039211 +1.4% 80.0 10000 0.002 0.004182 0.004000 +4.5% 0.003992 +4.8% 100.0 5000 0.005 0.010040 0.010000 +0.4% 0.009950 +0.9% 200.0 1000 0.050 0.094700 0.100000 -5.3% 0.095163 -0.5% 200.0 5000 0.010 0.020140 0.020000 +0.7% 0.019801 +1.7% 200.0 10000 0.005 0.010340 0.010000 +3.4% 0.009950 +3.9% 400.0 1000 0.100 0.176360 0.200000 -11.8% 0.181269 -2.7% 400.0 5000 0.020 0.039460 0.040000 -1.3% 0.039211 +0.6% 400.0 10000 0.010 0.020040 0.020000 +0.2% 0.019801 +1.2% 800.0 10000 0.020 0.040520 0.040000 +1.3% 0.039211 +3.3% 1000.0 5000 0.050 0.094260 0.100000 -5.7% 0.095163 -0.9% 2000.0 5000 0.100 0.175660 0.200000 -12.2% 0.181269 -3.1% 2000.0 10000 0.050 0.095580 0.100000 -4.4% 0.095163 +0.4% 4000.0 10000 0.100 0.175400 0.200000 -12.3% 0.181269 -3.2% Summary by 4Ns band (mean absolute relative error across the cells in the band): 4Ns band cells mean |d_Hal| mean |d_Kim| ---------------------------------------------------------------------------------------------------------------------- [0, 1) 3 255.6% 3.1% [1, 4) 3 30.5% 2.8% [4, 20) 7 2.5% 1.9% [20, 100) 10 6.2% 4.0% [100, inf) 12 4.9% 1.9% Worst Haldane failures (largest |d_Hal|): N= 50 s=0.001 4Ns= 0.2 u_hat=0.011760 2s=0.002000 d_Hal=+488.0% N= 50 s=0.002 4Ns= 0.4 u_hat=0.012060 2s=0.004000 d_Hal=+201.5% N= 200 s=0.001 4Ns= 0.8 u_hat=0.003544 2s=0.002000 d_Hal=+77.2% N= 50 s=0.005 4Ns= 1.0 u_hat=0.016020 2s=0.010000 d_Hal=+60.2% N= 200 s=0.002 4Ns= 1.6 u_hat=0.004742 2s=0.004000 d_Hal=+18.6% N= 50 s=0.010 4Ns= 2.0 u_hat=0.022560 2s=0.020000 d_Hal=+12.8% Worst Kimura disagreements (largest |z_Kim|): N= 50 s=0.100 4Ns= 20.0 u_hat=0.174660 Kimura=0.181269 d_Kim=-3.6% z=-3.89 N= 10000 s=0.100 4Ns= 4000.0 u_hat=0.175400 Kimura=0.181269 d_Kim=-3.2% z=-3.45 N= 5000 s=0.100 4Ns= 2000.0 u_hat=0.175660 Kimura=0.181269 d_Kim=-3.1% z=-3.30 N= 200 s=0.100 4Ns= 80.0 u_hat=0.176360 Kimura=0.181269 d_Kim=-2.7% z=-2.88 N= 1000 s=0.100 4Ns= 400.0 u_hat=0.176360 Kimura=0.181269 d_Kim=-2.7% z=-2.88 N= 1000 s=0.005 4Ns= 20.0 u_hat=0.009240 Kimura=0.009950 d_Kim=-7.1% z=-1.66 All 40 cells, z against Kimura: mean -0.395, max |z| 3.89 Cells with |z| > 2: 5 of 40 (about 2 expected by chance at 5%) ====================================================================================================================== SECTION 4B. IS THE KIMURA GAP AT LARGE s REAL OR IS IT NOISE? ====================================================================================================================== Each column of the grid shares a value of s across five values of N, and the five runs used five independent random streams. Combining the five z scores by Stouffer's method (sum of z divided by sqrt(5)) turns five weak hints into one sharp test of whether the deviation from Kimura is real. s mean d_Kim across the five N sum of z pooled z verdict ---------------------------------------------------------------------------------------------------------------------- 0.000 0.13% -0.27 -0.12 noise 0.001 0.13% 0.42 0.19 noise 0.002 1.73% 1.35 0.61 noise 0.005 -1.24% -1.42 -0.64 noise 0.010 0.36% 0.52 0.23 noise 0.020 0.89% 1.99 0.89 noise 0.050 -0.54% -1.97 -0.88 noise 0.100 -3.08% -16.40 -7.33 real Now the same measurements against three different large-N predictions. Only cells with 4Ns >= 100 are used, where finite N is no longer the limiting factor and every prediction should apply. 2s Haldane's published approximation 1 - exp(-2s) Kimura's formula in the large-N limit branching pi Haldane's own branching process, unlinearised: pi = 1 - exp(-(1+s) pi) s cells u_hat pooled 2s d 1-exp(-2s) d branching pi d ---------------------------------------------------------------------------------------------------------------------- 0.005 2 0.010190 0.010000 +1.9% 0.009950 +2.4% 0.009934 +2.6% 0.010 2 0.020090 0.020000 +0.4% 0.019801 +1.5% 0.019736 +1.8% 0.020 2 0.039990 0.040000 -0.0% 0.039211 +2.0% 0.038958 +2.6% 0.050 3 0.094847 0.100000 -5.2% 0.095163 -0.3% 0.093702 +1.2% 0.100 3 0.175807 0.200000 -12.1% 0.181269 -3.0% 0.176134 -0.2% Pooled u_hat is total fixations over total replicates for the cells in that row, which is the right way to combine binomial counts. ====================================================================================================================== SECTION 5. TIME TO FIXATION, CONDITIONAL ON FIXING ====================================================================================================================== Counted in generations, only over the replicates that actually fixed. Neutral benchmark: Kimura & Ohta 1969 give a mean of about 4N generations for a single neutral copy. Strong-selection benchmark: the deterministic logistic sweep from 1/(2N) to 1 - 1/(2N) takes about (2/s) ln(2N). N s 4Ns n fixed mean t SE median p10 p90 benchmark ratio ---------------------------------------------------------------------------------------------------------------------- 50 0.000 0.0 475 197.9 4.7 177 92 329 200 0.99 50 0.001 0.2 588 188.9 4.1 167 86 325 -- -- 50 0.002 0.4 603 195.2 4.5 169 89 333 -- -- 50 0.005 1.0 801 195.7 3.7 170 92 338 -- -- 50 0.010 2.0 1,128 191.5 3.0 170 92 322 -- -- 50 0.020 4.0 2,007 166.5 1.8 147 82 282 -- -- 50 0.050 10.0 4,738 110.0 0.6 102 65 166 -- -- 50 0.100 20.0 8,733 70.1 0.2 67 46 98 92 0.76 ...................................................................................................................... 200 0.000 0.0 291 759.5 23.4 646 360 1320 800 0.95 200 0.001 0.8 292 810.3 27.9 679 362 1385 -- -- 200 0.002 1.6 283 745.6 22.4 656 362 1321 -- -- 200 0.005 4.0 478 674.1 14.2 602 346 1134 -- -- 200 0.010 8.0 988 492.6 6.4 462 276 734 -- -- 200 0.020 16.0 1,933 323.4 2.3 307 209 460 -- -- 200 0.050 40.0 4,697 170.2 0.6 166 124 223 240 0.71 200 0.100 80.0 8,818 100.4 0.2 98 77 126 120 0.84 ...................................................................................................................... 1000 0.000 0.0 286 4038.7 113.0 3658 2008 6382 4000 1.01 1000 0.001 4.0 285 3361.6 103.3 2891 1657 5517 -- -- 1000 0.002 8.0 299 2502.9 60.8 2301 1362 3913 -- -- 1000 0.005 20.0 462 1398.1 19.0 1345 931 1972 3040 0.46 1000 0.010 40.0 996 842.9 6.3 812 612 1114 1520 0.55 1000 0.020 80.0 1,988 496.9 2.1 486 385 625 760 0.65 1000 0.050 200.0 4,735 237.3 0.6 233 192 288 304 0.78 1000 0.100 400.0 8,818 134.3 0.2 132 112 159 152 0.88 ...................................................................................................................... 5000 0.000 0.0 316 19668.6 580.8 17352 9896 32570 20000 0.98 5000 0.001 20.0 287 7235.9 115.4 7082 5025 9736 18421 0.39 5000 0.002 40.0 327 4280.6 59.1 4134 3062 5705 9210 0.46 5000 0.005 100.0 502 2059.5 16.3 2006 1631 2585 3684 0.56 5000 0.010 200.0 1,007 1177.8 6.0 1156 950 1437 1842 0.64 5000 0.020 400.0 1,973 663.1 2.1 651 557 784 921 0.72 5000 0.050 1000.0 4,713 303.2 0.5 298 260 353 368 0.82 5000 0.100 2000.0 8,783 168.1 0.2 166 147 193 184 0.91 ...................................................................................................................... 10000 0.000 0.0 323 39786.2 1212.1 35008 18401 69042 40000 0.99 10000 0.001 40.0 315 8468.6 111.9 8183 6245 11150 19807 0.43 10000 0.002 80.0 313 4927.1 52.8 4825 3782 6128 9903 0.50 10000 0.005 200.0 517 2375.3 16.5 2336 1934 2842 3961 0.60 10000 0.010 400.0 1,002 1319.7 6.0 1294 1095 1569 1981 0.67 10000 0.020 800.0 2,026 727.4 2.0 716 623 846 990 0.73 10000 0.050 2000.0 4,779 330.7 0.5 326 289 378 396 0.83 10000 0.100 4000.0 8,770 182.5 0.2 180 161 207 198 0.92 ...................................................................................................................... Neutral fixation times against the 4N prediction: N = 50: measured 197.9 +/- 4.7 generations, predicted 200, rel diff -1.1% N = 200: measured 759.5 +/- 23.4 generations, predicted 800, rel diff -5.1% N = 1000: measured 4038.7 +/- 113.0 generations, predicted 4000, rel diff +1.0% N = 5000: measured 19668.6 +/- 580.8 generations, predicted 20000, rel diff -1.7% N = 10000: measured 39786.2 +/- 1212.1 generations, predicted 40000, rel diff -0.5% ====================================================================================================================== SECTION 6. CONVERGENCE OF THE ESTIMATE AS TRIALS ACCUMULATE ====================================================================================================================== The running estimate after the first k replicates, with the Monte Carlo standard error at that k. Replicates are independent and identically distributed, so the prefix of the record is itself a valid smaller run. Cell N = 1000, s = 0.01. Kimura value 0.019801. 50,000 replicates. trials k fixations u_hat(k) SE(k) rel SE u_hat/Kimura ---------------------------------------------------------------------------------------------------------------------- 500 9 0.018000 0.005946 33.0% 0.9090 750 15 0.020000 0.005112 25.6% 1.0100 1,125 22 0.019556 0.004128 21.1% 0.9876 1,687 35 0.020747 0.003470 16.7% 1.0478 2,530 55 0.021739 0.002899 13.3% 1.0979 3,795 75 0.019763 0.002259 11.4% 0.9981 5,692 98 0.017217 0.001724 10.0% 0.8695 8,538 154 0.018037 0.001440 8.0% 0.9109 12,807 254 0.019833 0.001232 6.2% 1.0016 19,210 374 0.019469 0.000997 5.1% 0.9832 28,815 573 0.019885 0.000822 4.1% 1.0042 43,222 873 0.020198 0.000677 3.4% 1.0200 50,000 996 0.019920 0.000625 3.1% 1.0060 Cell N = 1000, s = 0. Kimura value 0.000500. 599,700 replicates. trials k fixations u_hat(k) SE(k) rel SE u_hat/Kimura ---------------------------------------------------------------------------------------------------------------------- 500 0 0.000000 -- -- -- 750 0 0.000000 -- -- -- 1,125 0 0.000000 -- -- -- 1,687 0 0.000000 -- -- -- 2,530 0 0.000000 -- -- -- 3,795 1 0.000264 0.000263 100.0% 0.5270 5,692 2 0.000351 0.000248 70.7% 0.7027 8,538 3 0.000351 0.000203 57.7% 0.7027 12,807 3 0.000234 0.000135 57.7% 0.4685 19,210 7 0.000364 0.000138 37.8% 0.7288 28,815 12 0.000416 0.000120 28.9% 0.8329 43,222 23 0.000532 0.000111 20.8% 1.0643 64,833 29 0.000447 0.000083 18.6% 0.8946 97,249 47 0.000483 0.000070 14.6% 0.9666 145,873 70 0.000480 0.000057 11.9% 0.9597 218,809 110 0.000503 0.000048 9.5% 1.0054 328,213 145 0.000442 0.000037 8.3% 0.8836 492,319 226 0.000459 0.000031 6.7% 0.9181 599,700 286 0.000477 0.000028 5.9% 0.9538 Cell N = 10000, s = 0.002. Kimura value 0.003992. 74,851 replicates. trials k fixations u_hat(k) SE(k) rel SE u_hat/Kimura ---------------------------------------------------------------------------------------------------------------------- 500 1 0.002000 0.001998 99.9% 0.5010 750 1 0.001333 0.001332 99.9% 0.3340 1,125 5 0.004444 0.001983 44.6% 1.1133 1,687 9 0.005335 0.001774 33.2% 1.3364 2,530 11 0.004348 0.001308 30.1% 1.0891 3,795 16 0.004216 0.001052 24.9% 1.0561 5,692 21 0.003689 0.000804 21.8% 0.9242 8,538 33 0.003865 0.000672 17.4% 0.9682 12,807 49 0.003826 0.000546 14.3% 0.9584 19,210 79 0.004112 0.000462 11.2% 1.0302 28,815 107 0.003713 0.000358 9.6% 0.9302 43,222 177 0.004095 0.000307 7.5% 1.0258 64,833 280 0.004319 0.000258 6.0% 1.0819 74,851 313 0.004182 0.000236 5.6% 1.0475 ====================================================================================================================== SECTION 7. THE HEADLINE NUMBERS ====================================================================================================================== N = 1000, s = 0.01: a single new copy fixes 1.992% of the time, so it is lost 98.008% of the time (1 in 50 survives). N = 1000, s = 0.05: a single new copy fixes 9.470% of the time, so it is lost 90.530% of the time (1 in 11 survives). N = 10000, s = 0.01: a single new copy fixes 2.004% of the time, so it is lost 97.996% of the time (1 in 50 survives). N = 10000, s = 0.05: a single new copy fixes 9.558% of the time, so it is lost 90.442% of the time (1 in 10 survives). A mutation worth a 1% fitness gain in a population of 1000 diploids fixes 1.992% of the time in our runs. Haldane says 2.0%. Kimura says 1.980%. The same mutation with no advantage at all fixes 0.0477% of the time (exact answer 0.0500%). So a 1% advantage multiplies the survival odds by 41.8, and the mutation still loses 98.01 times out of 100. ====================================================================================================================== SECTION 8. PRECISION AUDIT ====================================================================================================================== The study plan asks for a standard error under 10% of the estimate in every cell. Realised relative standard errors, worst first: rel SE N s reps fixations ---------------------------------------------------------------------------------------------------------------------- 5.93% 200 0.002 59,678 283 5.92% 1000 0.001 147,100 285 5.91% 1000 0.000 599,700 286 5.90% 5000 0.001 149,851 287 5.85% 200 0.000 119,700 291 5.84% 200 0.001 82,384 292 5.77% 1000 0.002 74,825 299 5.64% 10000 0.002 74,851 313 Worst relative standard error anywhere in the grid: 5.93% Target met in all 40 cells: yes ====================================================================================================================== Total replicates simulated : 11,932,191 Total fixations observed : 90,675 Wall clock : 66.2 s ======================================================================================================================