compute.frequency.evolution.until.convergence: Compute the evolution of the frequency of the genotypes until...

Description Usage Arguments Details Value Examples

Description

Given a genome, this function simulate the evolution of the frequency of all the possible genotype that exist until convergence has been reach.

Usage

1
2
3
compute.frequency.evolution.until.convergence(genome,
  initial.frequency = NULL, min.generations = 25, max.generations = 1e+05,
  criteria = 1e-08, keep.all.generation = TRUE)

Arguments

genome

A S4 object of the type genome

initial.frequency

The initial frequency of the various genotype. If NULL is given the initial frequencies will all be set to the same value

min.generations

The minimum number of generation to be computed

max.generations

The maximum number of generation to be computed. If the convergence is not reached in this time, iteration stop and a warning is emited. A value of zero indicate no limit.

criteria

If the sum of the slope of the evolution of the genotype frequency is under this number, the simulation stop (if the other criteria are also met)

keep.all.generation

tell wether to give only the value of the last three generations or all of them. Kepping only the last generations improve computation time. Default value = TRUE

Details

Convergence is evaluated in the following way. First, a few generation are perform (warmup) without measuring the criteria since they might be oscillation due to male/female proportion effect. Then, at each generation, the total slope \abs(\vec({_t}-\vec{x_{t-1}}) and the total curvature \abs(\vec({_t}-\vec{x_{t-1}})

Value

A matrix containing the frequencies of each genotype at each generation

Examples

1
2
3
4
locus1 = data.frame(allele1=c(1,1),allele2 = c(1,2),sd = c(0,1),fitness.male=c(1,1),fitness.female=c(1,1))
locus2 = data.frame(allele1=  c(1,1,2),allele2 = c(1,2,2),fitness.female = c(1,0.9,0.8),fitness.male = c(0.6,0.8,1))
genome = create.genome(locus1,locus2)
freqs <- compute.frequency.evolution.until.convergence(genome)

frederic-michaud/hapex documentation built on May 15, 2019, 3:29 p.m.