This function generates a summary table of age trend predictions for a specified quantile and demographic group. The table includes the predicted volume values, percentage changes between age intervals, and other details for either females, males, or a comparison between both genders.
age_table_gen(result, q ="median", s ="F")
Arguments
result: A data object containing prediction results and metadata.
q: A string specifying the quantile of interest (e.g., "quantile_50" for the median).
s: A string indicating the demographic group for which the summary table is generated:
"F" for female
"M" for male
"F vs M" for comparison between females and males
Returns
A datatable object (from the DT package) containing the age trend summary table with the following columns:
Age: The age values at regular intervals (rounded to the nearest 10).
Percentile.Volume: The predicted volume values for the specified quantile (only for females or males).
PercentageChange (%): The percentage change in volume between consecutive age intervals (only for females or males).
Percentile.Volume_F: The predicted volume values for females (when comparing genders).
Percentile.Volume_M: The predicted volume values for males (when comparing genders).
PercentageChange_F (%): The percentage change for females (when comparing genders).
PercentageChange_M (%): The percentage change for males (when comparing genders).
Details
The function processes the input data to filter predictions based on the specified quantile and demographic group. It calculates percentage changes in predicted volume values for easier interpretation of trends. For gender comparisons ("F vs M"), it generates side-by-side columns for females and males.
The output table is formatted using the DT package with additional features, such as CSV and Excel export options.