lr_distribution: Composed likelihood-ratio distribution over a marker profile

View source: R/lr_distribution.R

lr_distributionR Documentation

Composed likelihood-ratio distribution over a marker profile

Description

Builds the exact distribution of the total \log_{10}\mathrm{LR} for a profile of independent markers. Each marker's per-marker LR distribution is computed from its joint H1 / H2 table, and the distributions are convolved (conditional independence: the total \log_{10}\mathrm{LR} is the sum of the per-marker \log_{10}\mathrm{LR}s). The result is an as_lr_dist() object, so summary.lr_dist(), plot.lr_dist() and quantile.lr_dist() apply directly.

Usage

lr_distribution(
  models,
  poi = NULL,
  method = c("exact", "grid"),
  grid_points = 512L
)

Arguments

models

A marker_model object or a list of them (see marker_model()). A single model is accepted and returns its own per-marker distribution unchanged. List names, when present and non-empty, are recorded in the "markers" attribute.

poi

Optional character scalar naming the person of interest, applied to every model. When NULL (default) the POI is resolved per model by the joint engine (see per_marker_kl()).

method

Composition method. "exact" (default) performs the exact sparse convolution and is bit-for-bit with the reference engine. "grid" projects each distribution onto a regular lattice before convolving (mass- and mean-preserving, with a shape error that shrinks with grid_points); it requires finite support and is useful for very long profiles.

grid_points

Integer number of lattice points used when method = "grid" (ignored for "exact"). Default 512.

Details

Markers are assumed conditionally independent given the hypothesis (no linkage); linked-marker composition arrives with the F5 linkage work. +Inf / -Inf atoms (which arise under mutation = "none" when a hypothesis assigns zero mass to a state the other supports) propagate through the exact convolution and are reported by summary.lr_dist(); method = "grid" rejects infinite support.

Value

An object of class lr_dist (a data.frame with columns log10_lr, p_h1, p_h2), with attributes "markers" (the marker identifiers in input order), "n_markers", "method" and "poi" (the resolved POI; a vector if it differs across models).

See Also

marker_model(), as_lr_dist(), summary.lr_dist(), plot.lr_dist(), quantile.lr_dist(), per_marker_kl_profile().

Examples

if (requireNamespace("pedtools", quietly = TRUE)) {
  ped <- pedtools::nuclearPed(1)
  models <- list(
    D3 = marker_model(ped, "D3", c("15" = 0.4, "16" = 0.6),
                      mutation = list(model = "equal", rate = 1e-3)),
    vWA = marker_model(ped, "vWA", c("a" = 0.2, "b" = 0.3, "c" = 0.5),
                       mutation = list(model = "equal", rate = 1e-3))
  )
  d <- lr_distribution(models)
  summary(d)
  quantile(d)
}

mispitools documentation built on Aug. 26, 2026, 1:08 a.m.