stabilize: Stabilization of mutation matrix

View source: R/stabilize.R

stabilizeR Documentation

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)

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.

Details

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

Value

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

Author(s)

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

References

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

Examples


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)


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