View source: R/makeReversible.R
makeReversible | R Documentation |
This function implements three methods for transforming a mutation model
(M,p)
into a reversible one, (R,p)
. All methods are based on Metropolis-
Hastings proposal functions.
makeReversible(
mutmat,
method = c("BA", "MH", "PR"),
adjust = TRUE,
afreq = NULL
)
mutmat |
A |
method |
A character indicating which transformation to use. Either "BA" (Barker), "MH" (Metropolis-Hastings) or "PR" (preserved rate). |
adjust |
Logical. If TRUE (default), the overall mutation rate is
adjusted to preserve the original rate; see |
afreq |
A vector of allele frequencies. Extracted from |
These transformations may also be applied through the transform
argument of
mutationMatrix()
and mutationModel()
.
A reversible mutation matrix with the same allele frequencies.
m = mutationMatrix("equal", afreq = c(a=0.2, b=0.3, c=0.5), rate = 0.2)
makeReversible(m, "BA")
makeReversible(m, "MH")
makeReversible(m, "PR")
makeReversible(m, "BA", adjust = FALSE) # rate differs!
# Apply to full model with different female/male rates
mod = mutationModel("equal", afreq = c(a=0.2, b=0.3, c=0.5),
rate = list(female = 0.1, male = 0.2))
modR = makeReversible(mod)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.