Package 'forensicolors'

Title: Forensic Colors
Description: An open source software package written in R statistical language. It consist in a set of tools to compute likelihood ratios based on pigmentation traits. Also, it allows computing conditional probabilities for unidentified individuals based on missing person characteristics. A set of tailored plots are incorporated to analyze likelihood ratio distributions.
Authors: Franco Marsico [aut, cre], Thore Egeland [aut]
Maintainer: Franco Marsico <[email protected]>
License: GPL (>= 3)
Version: 1.0.0
Built: 2025-02-21 05:16:21 UTC
Source: https://github.com/marsicofl/forensicolors

Help Index


Compute Likelihood Ratios (LRs)

Description

This function calculates the Likelihood Ratios (LRs) for each combination of hair colour, skin colour, and eye colour between two datasets. It assumes one dataset (conditioned) contains numerators and the other (unconditioned) contains denominators.

Usage

compute_LRs(conditioned, unconditioned)

Arguments

conditioned

A dataframe with at least the columns 'hair_colour', 'skin_colour', 'eye_colour', and 'numerators'.

unconditioned

A dataframe with at least the columns 'hair_colour', 'skin_colour', 'eye_colour', and 'f_h_s_y'.

Value

A dataframe with the merged data and computed LRs.

Examples

data <- simRef()
conditioned <- conditionedProp(data, 1, 1, 1, 0.01, 0.01, 0.01) 
unconditioned <- refProp(data)
compute_LRs(conditioned, unconditioned)

Compute Conditioned Proportions for UPs

Description

This function calculates the conditioned proportions for pigmentation traits for UP, when UP is MP. It considers error rates for observations of hair color, skin color, and eye color.

Usage

conditionedProp(data, h, s, y, eh, es, ey)

Arguments

data

A data.frame containing the characteristics of UPs.

h

An integer representing the MP's hair color.

s

An integer representing the MP's skin color.

y

An integer representing the MP's eye color.

eh

A numeric value representing the error rate for observing hair color.

es

A numeric value representing the error rate for observing skin color.

ey

A numeric value representing the error rate for observing eye color.

Value

A numeric vector containing the conditioned proportion (numerator) for each individual in the dataset. These values are calculated based on the probability of observing the given combination of characteristics in the MP, compared to each UP.


Plot Weighted Distribution of Log10(LR)

Description

This function plots the weighted distribution of the log10 of likelihood ratios (LR), using the probabilities provided in 'numerators' for H1 and 'f_h_s_y' for H2 as weights. The densities are shown for two hypotheses, H1 and H2.

Usage

plotLR(data)

Arguments

data

A dataframe that must contain the columns 'LR', 'numerators', and 'f_h_s_y'.

Value

A ggplot object showing the weighted density plot.

Examples

data <- forensicolors::simRef()
conditioned <- conditionedProp(data, 1, 1, 1, 0.01, 0.01, 0.01)
unconditioned <- forensicolors:::refProp(data)
likelihoods <- forensicolors:::compute_LRs(conditioned, unconditioned)
plotLR(likelihoods)

Generate a dataframe with hair colour, skin colour, eye colour and their specific combination frequencies

Description

This function creates a dataframe that lists every unique combination of hair colour, skin colour, and eye colour in the provided dataset, along with the proportion of occurrences of each combination.

Usage

refProp(data)

Arguments

data

A data.frame containing the characteristics of individuals.

Value

A data.frame with columns for hair_colour, skin_colour, eye_colour, and f_h_s_y.

Examples

data <- simRef(1000)
refProp(data)

Generate Reference Properties for a Hypothetical Population

Description

This function simulates a dataset representing physical characteristics (hair color, skin color, eye color) of a hypothetical population, based on conditional probability distributions. The size of the simulated population can be adjusted by the user.

Usage

simRef(n = 1000, seed = 1234)

Arguments

n

The number of individuals in the simulated population.

seed

Selected seed for simulations.

Value

A data.frame with three columns: hair_colour, skin_colour, and eye_colour, each representing the respective characteristics of each individual in the sample population. The hair color is simulated based on predefined probabilities, and skin and eye colors are generated conditionally based on the hair color.

Examples

simRef(1000) # Generates a data frame with 1000 entries based on the defined distributions.