stepwiseReversible: Reversible stepwise mutation model

View source: R/stepwiseReversible.R

stepwiseReversibleR Documentation

Reversible stepwise mutation model

Description

A reversible stepwise mutation model is created following the approach of Dawid et al. (2002).

Usage

stepwiseReversible(alleles, afreq, rate, range, maxRateOnly = FALSE)

Arguments

alleles

A vector of integer integers.

afreq

A numeric vector of allele frequencies.

rate

A numeric mutation rate.

range

A positive number.

maxRateOnly

A logical, by default FALSE. See Value.

Details

For the stepwise reversible model, the mutation rate r_{i,j},\, i\neq j is proportional to the overall mutation rate \lambda for given values of the range, the allele frequency p_i and n, the number of alleles. Hence, one can determine bounds UW and UB so that the model is well defined if \lambda \leq UW and bounded, i.e., r_{i,j} \leq p_j,\, i\neq j, if \lambda \leq UB, The bounds UW and UB are computed.

Value

A reversible stepwise mutation model with overall mutation rate equal to rate.

If maxRateOnly is TRUE, the function returns a vector of two numbers named UW and UB. The first of these is the maximum overall mutation rate for a well-defined stepwise reversible mutation matrix with the given input. The latter (UB) is the maximum rate under the additional restraint that the model is bounded by afreq.

Author(s)

Thore Egeland.

Examples

stepwiseReversible(alleles = 1:3,
                   afreq = c(0.2, 0.3,  0.5),
                   rate = 0.001,
                   range = 0.1)

stepwiseReversible(alleles = 1:3,
                   afreq = c(0.2, 0.3,  0.5),
                   range = 0.1,
                   maxRateOnly = TRUE)

# Model not well defined:
## Not run: 
stepwiseReversible(alleles = 1:3,
                   afreq = c(0.2, 0.3,  0.5),
                   rate = 0.7,
                   range = 0.1)

## End(Not run)

magnusdv/pedmut documentation built on Jan. 31, 2024, 7:06 a.m.