balance1 {BookEKM} | R Documentation |
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.
balance1(Q, p, alternative=2)
Q |
irreducible and aperiodic mutation matrix |
p |
allele frequency |
alternative |
Currently 1 or 2. See 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)
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. |
Thore Egeland <Thore.Egeland@nmbu.no>
Egeland et al(2016)
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)