per_marker_kl_profile: Per-marker bidirectional KL across a marker profile

View source: R/per_marker_kl.R

per_marker_kl_profileR Documentation

Per-marker bidirectional KL across a marker profile

Description

Vectorised wrapper around per_marker_kl() for a list of marker_model objects. Returns a data.frame with one row per input model in input order. When the profile shares one pedigree topology, uses no linkage, and every mutation model is wired to the C++ backend (none / equal / stepwise), evaluation routes through a single cross-marker C++ batch call with a shared mutation-matrix cache; otherwise it falls back to a per-marker R-level loop.

All models must share the same pedigree topology if poi is supplied as a scalar; otherwise the POI is resolved independently for each model.

Usage

per_marker_kl_profile(models, poi = NULL)

Arguments

models

A list of marker_model objects. Names of the list, when present and non-empty, override the per-model marker_id in the output marker column.

poi

Optional character scalar applied to every model, or NULL (default) for per-model resolution. Pass a vector by mapping the loop yourself if you need heterogeneous POIs.

Value

A data.frame with the same columns as per_marker_kl() and nrow(out) == length(models). When poi is a scalar, attribute "poi" carries that value; otherwise the resolved POIs appear as attribute "poi" of length length(models).

See Also

per_marker_kl().

Examples

if (requireNamespace("pedtools", quietly = TRUE)) {
  ped <- pedtools::nuclearPed(1)
  models <- list(
    M1 = marker_model(ped, "M1", c("a" = 0.4, "b" = 0.6),
                      mutation = list(model = "equal", rate = 1e-3)),
    M2 = marker_model(ped, "M2", c("a" = 0.2, "b" = 0.3, "c" = 0.5),
                      mutation = list(model = "equal", rate = 1e-3))
  )
  per_marker_kl_profile(models)
}

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