Learn R Programming

pedmut (version 0.8.0)

stabilize: Stabilization of mutation matrix

Description

Produces a mutation matrix close to the input mutmat, for which the given frequency vector is the stationary distribution. Several methods for doing this are described by Simonsson and Mostad (2016); only the "PM" method is included here.

Usage

stabilize(mutmat, afreq = NULL, method = "PM", details = FALSE)

Value

An object of the same class the input mutmat; either a matrix, a mutationMatrix or a mutationModel.

Arguments

mutmat

A mutation matrix.

afreq

A vector of allele frequencies

method

Either "DP", "RM" or "PM". Currently only "PM" is implemented.

details

A logical. If TRUE, the complete Familias output is included.

Author

Petter Mostad, Thore Egeland, Ivar Simonsson, Magnus D. Vigeland

Details

This function is based on, and reuses code from, the stabilize() method of the Familias R package.

References

Simonsson, Mostad: Stationary Mutation models. (FSI: Genetics, 2016).

Examples

Run this code

afreq = c(.2, .3, .5)
m = mutationMatrix("stepwise", alleles = 1:3, afreq = afreq,
                   rate = 0.1, rate2 = 0.01, range = 0.1)
m
stabilize(m, afreq = c(.3,.3,.4))


### Example with full model (i.e., male and female)

M = mutationModel("stepwise", alleles = 1:3, afreq = afreq,
                   rate = list(male = 0.1, female = 0.2),
                   rate2 = 0.01, range = 0.1)
M
stabilize(M)

Run the code above in your browser using DataLab