calculateEmpiricalDensity: Calculate Empirical Age Density

View source: R/imputeAges.R

calculateEmpiricalDensityR Documentation

Calculate Empirical Age Density

Description

Calculates empirical age density distributions for different subgroups in the data, separated by sex and genetic testing status.

Usage

calculateEmpiricalDensity(
  data,
  aff_column = "aff",
  age_column = "age",
  sex_column = "sex",
  geno_column = "geno",
  n_points = 10000,
  sex_specific = TRUE
)

Arguments

data

A data frame containing the family data

aff_column

Name of the affection status column

age_column

Name of the age column

sex_column

Name of the sex column

geno_column

Name of the genotype column

n_points

Number of points to use in density estimation

sex_specific

Logical; whether to calculate sex-specific densities

Value

A list of density objects for different subgroups (tested/untested, male/female)

Examples

# Create sample data
data <- data.frame(
  sex = c(1, 1, 2, 2),
  aff = c(0, 0, 0, 0),
  age = c(45, 50, 35, 40),
  geno = c("1/2", NA, "1/2", NA)
)

# Calculate density with sex-specific parameters
density_sex <- calculateEmpiricalDensity(data, sex_specific = TRUE)

# Calculate density without sex-specific parameters
density_nosex <- calculateEmpiricalDensity(data, sex_specific = FALSE)

penetrance documentation built on Sept. 9, 2026, 1:07 a.m.