Learn R Programming

hwep (version 2.0.3)

freqnext: Update genotype frequencies after one generation

Description

After one generation of random mating, update the genotype frequencies.

Usage

freqnext(freq, alpha, segmat = NULL, more = FALSE, check = TRUE)

Value

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).

Arguments

freq

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.

alpha

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.

segmat

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.

more

A logical. Should we return more output (TRUE) or less (FALSE). See the Value section for details.

check

Should we correct for minor numerical issues? Defaults to TRUE.

Author

David Gerard

Examples

Run this code
freq <- c(0.5, 0, 0, 0, 0.5)
freqnext(freq = freq, alpha = 0)

Run the code above in your browser using DataLab