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 = NULL, check = TRUE)

Arguments

mutmat

A mutationMatrix object, typically made with mutationMatrix().

lump

A nonempty subset of the alleles (i.e., the column names of mutmat), or a list of several such subsets.

afreq

A vector with frequency vector, of the same length as the size of mutmat. If not given, the afreq attribute of the matrix is used.

check

A logical indicating if lumpability should be checked before lumping. Default: TRUE.

labelSep

((For debugging) A character used to name lumps by pasting allele labels.

mutmod

A mutationModel object, typically made with mutationModel().

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.

See Also

mutationModel(), mutationMatrix()

Examples



### Example 1: Lumping a mutation matrix
mat = mutationMatrix("eq", alleles = 1:5,
                     afreq = rep(0.2, 5), rate = 0.1)
mat

# Lump alleles 3, 4 and 5
mat2 = lumpedMatrix(mat, lump = 3:5)
mat2

# Example 2: Full model, proportional
mutrate = list(male = 0.1, female = 0.2)
mod = mutationModel("prop", alleles = 1:4,
                    rate = mutrate, afreq = c(.1,.2,.3,.4))
mod

# Lump alleles 3 and 4
mod2 = lumpedModel(mod, lump = 3:4)
mod2


pedmut documentation built on Nov. 5, 2023, 1:10 a.m.