ibdLoglik: Pairwise IBD likelihood

View source: R/ibdLoglik.R

ibdLoglikR Documentation

Pairwise IBD likelihood

Description

Given genotype data from two individuals, computes the log-likelihood of a single set of IBD coefficients, either kappa = (\kappa_0, \kappa_1, \kappa_2) or the Jacquard coefficients delta = (\Delta_1, ..., \Delta_9). The ibdLoglikFUN version returns an efficient function for computing such likelihoods, suitable for optimisations such as in ibdEstimate().

Usage

ibdLoglik(x = NULL, ids = NULL, kappa = NULL, delta = NULL)

ibdLoglikFUN(x, ids, input = c("kappa", "kappa02", "delta"))

Arguments

x

A ped object or a list of such.

ids

A vector of ID labels.

kappa

A probability vector of length 3.

delta

A probability vector of length 9.

input

Either "kappa", "kappa02" or "delta". See Value.

Value

ibdLoglik() returns a single number; the total log-likelihood over all markers included.

ibdLoglikFUN() returns a function for computing such log-likelihoods. The function takes a single input vector p, whose interpretation depends on the input parameter:

  • "kappa": p is expected to be a set of kappa coefficients (\kappa_0, \kappa_1, \kappa_2).

  • "kappa02": p should be a vector of length 2 containing the coefficients \kappa_0 and \kappa_2. This is sometimes a convenient shortcut when working in the IBD triangle.

  • "delta": Expects p to be a set of condensed Jacquard coefficients (\Delta_1, ..., \Delta_9).

Examples

# Siblings typed with 10 markers
x = nuclearPed(2) |> markerSim(N = 10, alleles = 1:4)

# Calculate log-likelihood at a single point
k = c(0.25, 0.5, 0.25)
ibdLoglik(x, ids = 3:4, kappa = k)

# Or first get a function, and then apply it
llFun = ibdLoglikFUN(x, ids = 3:4, input = "kappa")
llFun(k)



forrel documentation built on Sept. 11, 2024, 9:15 p.m.