#------------------------------------------------
# Example: Identification of a missing grandchild
#------------------------------------------------
# Database with 5 STR markers (increase to make more realistic)
db = NorwegianFrequencies[1:5]
# Pedigree with missing person (MP); grandmother is genotyped
x = linearPed(2) |>
relabel(old = 5, new = "MP") |>
profileSim(markers = db, ids = "2", seed = 123)
### Scenario 1: Unrelated POI --------------------
# Generate random unrelated profile
poi = singleton("POI") |>
profileSim(markers = db, seed = 1234)
# Compute LR
lr = missingPersonLR(x, missing = "MP", poi = poi)
lr
lr$LRperMarker
### Scenario 2: POI is the missing person --------
# A small simulation example
# Simulate profiles for MP conditional on the grandmother
N = 10
y = profileSim(x, N = N, ids = "MP", seed = 12345)
# Compute LRs for each sim
LRsims = lapply(y, missingPersonLR, missing = "MP", verbose = FALSE)
# Plot distribution
LRtotal = sapply(LRsims, function(a) a$LRtotal)
plot(density(LRtotal))
# LRs for each marker
LRperMarker = sapply(LRsims, function(a) a$LRperMarker)
LRperMarker
# Overlaying marker-wise density plots (requires tidyverse)
# library(tidyverse)
# t(LRperMarker) |> as_tibble() |> pivot_longer(everything()) |>
# ggplot() + geom_density(aes(value, fill = name), alpha = 0.6)
Run the code above in your browser using DataLab