Learn R Programming

ComBatFamQC (version 1.0.6)

customize_percentile: Generate Predicted Quantiles for Age Trends

Description

This function computes predicted quantiles for a specified feature and demographic group based on a GAMLSS model. The function interpolates predictions over a range of ages while accounting for fixed covariates.

Usage

customize_percentile(age_list, feature, q = 0.75, s = "F")

Value

A data frame containing columns for age, quantile type, prediction, and sex.

Arguments

age_list

A list containing all ROIs' true volumes, age trend estimates, and the fitted GAMLSS model.

feature

A string specifying the feature of interest within the age_list.

q

A numeric value between 0 and 1 representing the quantile to predict (e.g., 0.5 for the median).

s

A string indicating the gender of the group for which the predictions are generated (e.g., "F" for female, "M" for male).

Details

This function uses a GAMLSS model to generate predictions for a specified quantile and demographic group. The predictions are computed over a sequence of ages (age_test) that spans the observed age range in the data. The function adjusts for fixed covariates such as icv by using their mean values from the input data.

Examples

Run this code
sub_df <- age_df[,c("Volume_1", "age", "sex", "ICV_baseline")] |> na.omit()
colnames(sub_df) <- c("Volume_1", "age", "sex", "icv")
age_list <- list("Volume_1" = age_list_gen(sub_df = sub_df))
customize_percentile(age_list, feature = "Volume_1", q = 0.5, s = "F")

Run the code above in your browser using DataLab