sim_lr_genetic: Simulate Likelihood Ratios from Genetic Data

View source: R/sim_lr_genetic.R

sim_lr_geneticR Documentation

Simulate Likelihood Ratios from Genetic Data

Description

Simulates likelihood ratio (LR) distributions based on genetic (DNA) marker data. This function generates expected LR distributions under two hypotheses:

  • H1 (Related): The unidentified person IS the missing person

  • H2 (Unrelated): The unidentified person is NOT the missing person

This function wraps functionality from the forrel package to perform missing person LR calculations using pedigree structures.

Usage

sim_lr_genetic(reference, missing, numsims = 100, seed = 123, numCores = 1)

Arguments

reference

A pedigree object with attached genetic markers. Can be created using pedtools functions like linearPed(), nuclearPed(), etc., with markers attached via setMarkers().

missing

Character or numeric. The ID/label of the missing person in the pedigree.

numsims

Integer. Number of simulations to perform. Default: 100.

seed

Integer. Random seed for reproducibility. Default: 123.

numCores

Integer. Number of CPU cores for parallel processing. Default: 1 (no parallelization).

Details

The function performs two types of simulations:

  1. H2 (Unrelated): Generates random genetic profiles for unrelated individuals using population allele frequencies, then calculates the LR for each profile.

  2. H1 (Related): Simulates genetic profiles for the actual missing person based on the pedigree structure, then calculates the LR for each profile.

The LR is computed using forrel::missingPersonLR(), which calculates the ratio of likelihoods: P(data | POI is MP) / P(data | POI is unrelated).

Value

A list with two components:

  • Unrelated: List of LR objects from simulations where POI is unrelated to the pedigree (H2 simulations)

  • Related: List of LR objects from simulations where POI is the actual missing person (H1 simulations)

Use lr_to_dataframe to convert this to a data.frame for further analysis.

References

Marsico FL, Vigeland MD, Egeland T, Herrera Pinero F (2021). "Making decisions in missing person identification cases with low statistical power." Forensic Science International: Genetics, 52, 102519. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.fsigen.2021.102519")}

Vigeland MD, Egeland T (2021). "Joint DNA-based disaster victim identification." Forensic Science International: Genetics, 52, 102465.

See Also

lr_to_dataframe for converting output to dataframe, sim_lr_prelim for non-genetic LR simulations, plot_lr_distribution for visualizing LR distributions, decision_threshold for computing optimal thresholds.

Examples

library(forrel)
library(pedtools)

# Create a simple pedigree: grandparent-parent-child
x <- linearPed(2)
plot(x)

# Add genetic markers (using Norwegian frequencies as example)
x <- setMarkers(x, locusAttributes = NorwegianFrequencies[1:5])

# Simulate a profile for the reference person (ID 2)
x <- profileSim(x, N = 1, ids = 2)

# Simulate LRs (person 5 is missing)
lr_sims <- sim_lr_genetic(x, missing = 5, numsims = 50, seed = 123)

# Convert to dataframe for analysis
lr_df <- lr_to_dataframe(lr_sims)
head(lr_df)

# Visualize distributions
plot_lr_distribution(lr_df)

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