View source: R/lr_to_dataframe.R
| lr_to_dataframe | R Documentation |
Converts the list output from sim_lr_genetic into a tidy
data frame suitable for analysis and visualization. Extracts the total
LR values from each simulation.
lr_to_dataframe(datasim)
datasim |
A list object returned by |
The function extracts LRtotal[["H1:H2"]] from each LR object
in the simulation lists. This represents the overall likelihood ratio
across all genetic markers.
A data.frame with two columns:
Unrelated: Numeric LR values from H2 simulations
Related: Numeric LR values from H1 simulations
The number of rows equals the number of simulations.
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")}
sim_lr_genetic for generating the input,
plot_lr_distribution for visualization,
lr_combine for combining with other LR sources.
library(forrel)
# Create pedigree and simulate
x <- linearPed(2)
x <- setMarkers(x, locusAttributes = NorwegianFrequencies[1:5])
x <- profileSim(x, N = 1, ids = 2)
# Simulate LRs
lr_sims <- sim_lr_genetic(x, missing = 5, numsims = 50, seed = 123)
# Convert to dataframe
lr_df <- lr_to_dataframe(lr_sims)
head(lr_df)
# Now can use with other functions
summary(log10(lr_df$Related))
plot_lr_distribution(lr_df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.