This function imputes ages for individuals in a dataset based on their affection status and sex using either Weibull, baseline, or empirical distribution.
Usage
imputeAges(
data,
na_indices,
baseline_male = NULL,
baseline_female = NULL,
alpha_male = NULL,
beta_male = NULL,
delta_male = NULL,
alpha_female = NULL,
beta_female = NULL,
delta_female = NULL,
baseline = NULL,
alpha = NULL,
beta = NULL,
delta = NULL,
empirical_density,
max_age,
sex_specific = TRUE
)
Arguments
- data
A data frame containing the individual data, including columns for age, sex, and affection status.
- na_indices
A vector of indices indicating the rows in the data where ages need to be imputed.
- baseline_male
A data frame containing baseline data for males, with columns 'cum_prob' and 'age'.
- baseline_female
A data frame containing baseline data for females, with columns 'cum_prob' and 'age'.
- alpha_male
Numeric, shape parameter for the Weibull distribution for males.
- beta_male
Numeric, scale parameter for the Weibull distribution for males.
- delta_male
Numeric, location parameter for the Weibull distribution for males.
- alpha_female
Numeric, shape parameter for the Weibull distribution for females.
- beta_female
Numeric, scale parameter for the Weibull distribution for females.
- delta_female
Numeric, location parameter for the Weibull distribution for females.
- baseline
A data frame containing baseline data (used for non-sex-specific analysis) with columns 'cum_prob' and 'age'.
- alpha
Numeric, shape parameter for the Weibull distribution (used for non-sex-specific analysis).
- beta
Numeric, scale parameter for the Weibull distribution (used for non-sex-specific analysis).
- delta
Numeric, location parameter for the Weibull distribution (used for non-sex-specific analysis).
- empirical_density
A density object or list of density objects containing the empirical density of ages, possibly sex-specific. If sex-specific, it should be a list with elements 'male' and 'female'.
- max_age
Integer, the maximum age considered in the analysis.
- sex_specific
Logical, indicating whether the imputation should be sex-specific. Default is TRUE.