lumpedMatrix: Combine alleles in a mutation matrix

View source: R/lumpedModel.R

lumpedMatrixR Documentation

Combine alleles in a mutation matrix

Description

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.

Usage

lumpedMatrix(mutmat, lump, afreq = NULL, check = TRUE, labelSep = NULL)

lumpedModel(mutmod, lump, afreq = attr(mutmod, "afreq"), check = TRUE)

Arguments

mutmat

A mutationMatrix object, typically made with mutationMatrix().

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 mutmat. Extracted from the model if not given.

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 mutationModel object, typically made with mutationModel().

Details

The lumping implemented in this function is based on the Markov chain lumping theory by Kemeny & Snell (1976). For other, specialised lumping, see lumpMutSpecial().

Value

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.

References

Kemeny & Snell (1976). Finite Markov Chains. Springer.

See Also

lumpMutSpecial().

Examples


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)


magnusdv/pedmut documentation built on June 8, 2025, 4:26 a.m.