| calculateEmpiricalDensity | R Documentation |
Calculates empirical age density distributions for different subgroups in the data, separated by sex and genetic testing status.
calculateEmpiricalDensity(
data,
aff_column = "aff",
age_column = "age",
sex_column = "sex",
geno_column = "geno",
n_points = 10000,
sex_specific = TRUE
)
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 |
A list of density objects for different subgroups (tested/untested, male/female)
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.