Learn R Programming

pedmut (version 0.8.0)

stepwiseReversible: Dawid's reversible stepwise 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)

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.

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.

Author

Thore Egeland.

Details

NB: This function is deprecated: Use mutationMatrix(model = "dawid", ...) instead.

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.

Examples

Run this code
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:
if (FALSE) {
stepwiseReversible(alleles = 1:3,
                   afreq = c(0.2, 0.3,  0.5),
                   rate = 0.7,
                   range = 0.1)
}

Run the code above in your browser using DataLab