After one generation of random mating, update the genotype frequencies.
freqnext(freq, alpha, segmat = NULL, more = FALSE, check = TRUE)
The current genotype frequencies. This should be a
vector of length K+1, where K is the ploidy of the species.
freq[i]
could contain the proportion of individuals
that have genotype i-1
.
A numeric vector containing the double reduction parameter(s).
This should be a
vector of length floor(ploidy/4)
where alpha[i]
is the probability of exactly i
pairs of IBDR alleles
being in the gamete. Note that sum(alpha)
should be less than
1, as 1 - sum(alpha)
is the probability of no double reduction.
You can provide your own segregation matrix.
segmat[i, j]
is the probability that a parent with
dosage i-1
produces a gamete with dosage j-1
.
A logical. Should we return more output (TRUE
) or
less (FALSE
). See the Value section for details.
Should we correct for minor numerical issues? Defaults
to TRUE
.
If more = FALSE
, then returns a vector of length
length(freq)
that contains the updated genotype frequencies
after one generation of random mating. If more = TRUE
, then
returns a list with these genotype frequencies (q
) as well as the
parental gamete frequencies (p
).
freq <- c(0.5, 0, 0, 0, 0.5)
freqnext(freq = freq, alpha = 0)
#> [1] 2.500000e-01 0.000000e+00 5.000000e-01 4.440892e-17 2.500000e-01