adjustReversible: Adjusts reversible mutation matrix

View source: R/adjustReversible.R

adjustReversibleR Documentation

Adjusts reversible mutation matrix

Description

The Metropolis - Hastings conversions may give a mutation matrix balancedMutmat with too small expected mutation rate (gamma). The balancedMutmat matrix is adjusted to have expected mutation rate a equal to that of the original mutation matrix mutmat.

Usage

adjustReversible(
  mutmat,
  balancedMutmat,
  method = "MH",
  afreq = NULL,
  check = TRUE
)

Arguments

mutmat

Original, non balanced, mutation matrix.

balancedMutmat

Balanced, mutation matrix.

method

Character. MH, PM or BA conversions.

afreq

A vector with allele frequencies. of the same length as the size of mutmat.

check

Logical. Checks if balancedMutmat is reversible.

Details

If balancedMutmat == NULL, mutmat is first balanced. The adjusted balanced matrix is

alpha * balancedMutmat + (1-alpha) * I

where

alpha is the ratio of the (expected mutation) rates of the original matrix, mutmat to the balanced version balancedMutmat and I is the identity matrix.

Value

Adjusted mutation matrix.

Author(s)

Thore Egeland.

See Also

[makeReversible()]

Examples

library(pedmut)
afreq = c(0.1, 0.3, 0.4, 0.2)
names(afreq) = 1:4
mutmat = mutationMatrix("onestep", rate = 0.02, alleles = 1:4)
adj = adjustReversible(mutmat, balancedMutmat = NULL, 
                       method = "BA", afreq = afreq,  check = TRUE)
attr(mutmat, "rate") - attr(adj, "rate")

thoree/mut2 documentation built on May 16, 2023, 7:56 p.m.