lumpedMatrix | R Documentation |
Reduce a mutation matrix by combining a set of alleles into one lump, if this can be done without distorting the mutation process of the remaining alleles. Such allele lumping can give dramatic efficiency improvements in likelihood computations with multi-allelic markers, in cases where only some of the alleles are observed in the pedigree.
lumpedMatrix(mutmat, lump, afreq = NULL, check = TRUE, labelSep = NULL)
lumpedModel(mutmod, lump, afreq = attr(mutmod, "afreq"), check = TRUE)
mutmat |
A |
lump |
A vector containing the alleles to be lumped together, or a list of several such vectors. |
afreq |
A vector with allele frequencies, of the same length as the size
of |
check |
A logical indicating if lumpability (i.e., the row-sum criterium of Kemeny & Snell) should be checked before lumping. Default: TRUE. |
labelSep |
A character used to name lumps by pasting allele labels. (For debugging.) |
mutmod |
A |
The lumping implemented in this function is based on the Markov chain lumping
theory by Kemeny & Snell (1976). For other, specialised lumping, see
lumpMutSpecial()
.
A reduced mutation model. If the original matrix has dimensions
n\times n
, the result will be k\times k
, where k
= n - length(lump) + 1
.
Kemeny & Snell (1976). Finite Markov Chains. Springer.
lumpMutSpecial()
.
af = c(.1, .2, .3, .4)
names(af) = 1:4
### Example 1: Lumping a mutation matrix
mat = mutationMatrix("eq", afreq = af, rate = 0.1)
mat
# Lump
lumpedMatrix(mat, lump = 3:4)
lumpedMatrix(mat, lump = 2:4)
# Example 2: Full model, proportional
mutrate = list(male = 0.1, female = 0.2)
mod = mutationModel("prop", afreq = af, rate = mutrate)
mod
# Lump
lumpedModel(mod, lump = 2:4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.