balance1 {BookEKM}R Documentation

Makes Mutation Matrix Balanced

Description

An irreducible and aperiodic mutation matrix is tranformed to satisfy detailed balanced (DB) using the Metropolis-Hastings algorithm. DB is important since swapping of genotypes can be performed without changing LR if and only DB holds.

Usage

balance1(Q, p, alternative=2)

Arguments

Q

irreducible and aperiodic mutation matrix

p

allele frequency

alternative

Currently 1 or 2. See details.

Details

The default option alternative=2 gives the substitution q_ij => q_ij min(1, p_j/p_i * q_ji/q_ij) while alternative=1 implements the standard Metropolis-Hastings. q_ij => (p_i q_ij + p_j q_ji ) / (2p_i)

Value

P

Transformed mutation matrix

balancedCheck

Should be TRUE, i.e., indicate that DB holds.

stationaryCheck

Should be TRUE, i.e., indicate that stationarity holds.

expectedMut

Expected mutation rate. Should remain unchanged for default.

Author(s)

Thore Egeland <Thore.Egeland@nmbu.no>

References

Egeland et al(2016)

Examples

library(Familias)
n <- 4
p <- 1:n
p <- c(0.1,0.3,0.4,0.2)
R <- (n-1)*0.001
p <- p/sum(p)
n <- length(p)
Q <-FamiliasLocus(frequencies=p, allelenames= 1:length(p), 
                  name="locus1", MutationModel="Equal", 
                  MutationRate=R)$maleMutationMatrix
balance1(Q,p)

[Package BookEKM version 1.0 Index]