50% off: Unlimited data and AI learning.
State of Data and AI Literacy Report 2025

forrel (version 1.7.1)

ibdLoglik: Pairwise IBD likelihood

Description

Given genotype data from two individuals, computes the log-likelihood of a single set of IBD coefficients, either kappa = (κ0,κ1,κ2) or the Jacquard coefficients delta = (Δ1,...,Δ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"))

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 (κ0,κ1,κ2).

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

  • "delta": Expects p to be a set of condensed Jacquard coefficients (Δ1,...,Δ9).

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.

Examples

Run this code
# 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)


Run the code above in your browser using DataLab