Bob O'H
Posts: 2564 Joined: Oct. 2005

Quote (Zachriel @ June 17 2009,20:59)  Some bits from Mendel's Accountant source code.
Offspring:
if(fitness_dependent_fertility) then fitness_adjusted_offspring = num_offspring*sqrt(post_sel_fitness)

Any idea why the square root of post_sel_fitness?
Quote  Favorable Mutations:
c... Compute mean absolute fitness effect for favorable mutations.
sum = 0. d2 = 1.
do i=1,1000000 d1 = d2 d2 = exp(alpha_fav*(0.000001*i)**gamma_fav) sum = sum + d1 + d2 end do
fav_mean = 0.0000005*sum*max_fav_fitness_gain 
Ugh. That's a horrible way to do the integration. I recognise the density (George Box was promoting it in the 50s), and it has an analytic solution: alpha_fav*gamma_fav*Gamma(1/gamma_fav), where Gamma() is the gamma function.
(ref: Box, G. E. P. 1953. A note on regions for tests of kurtosis. Biometrika 40: 465468)
Also, where does the 0.0000005 come from? I'm always suspicious of constants like that.
Quote  Phenotypic Fitness:
noise = sqrt(geno_fitness_variance*(1.  heritability) /heritability + non_scaling_noise**2)
c... Add noise to the fitness to create a phenotypic fitness score... do i=1,total_offspring pheno_fitness(i) = fitness(i) + random_normal()*noise 
The random_normal()*noise[/color] is environmental variation, and we would typically set it to be constant. Because MA defines heritability, they have to backcalculate the environmental variance: that's what geno_fitness_variance*(1.  heritability) /heritability is doing. Except it's wrong, because the non_scaling_noise is added too, so the heritability isn't a heritability.
Also, note what this backcalculation means: it scales the environmental variance to the genetic variance, so as genetic variation decreases, the environment becomes more stable. This is bollocks.
They should really set the environmental variance. The problem is getting an easily understood scaling, but that can be done by scaling to the mean fitness effects.
Also, check through: the calculations look OK for log(fitness): they range from infinity to infinity and are additive. But on what scale does pheno_fitness affect? On this scale, or the exponential scale?
Quote  Unrestricted probability selection:
c... For unrestricted probability selection, divide the phenotypic c... fitness by a uniformly distributed random number prior to c... ranking and truncation. This procedure allows the probability c... of surviving and reproducing in the next generation to be c... directly related to phenotypic fitness and also for the correct c... number of individuals to be eliminated to maintain a constant c... population size.
do i=1,total_offspring work_fitness(i) = work_fitness(i)/(randomnum(1) + 1.d15) end do
Divide by randomnum as well as add nonheritable noise to the phenotype? 
:) No idea what's going on.
 It is fun to dip into the various threads to watch cluelessness at work in the hands of the confident exponent.  Soapy Sam (so say we all)
