age_trend_plot {ComBatFamQC} | R Documentation |
Generate Age Trend Plot
Description
This function creates an age trend plot for a specified feature and demographic group based on GAMLSS model predictions.
The function supports both static plots using ggplot2
and interactive plots using plotly
.
Usage
age_trend_plot(
age_list,
f,
s = "none",
q = "median",
cus_list = NULL,
use_plotly = TRUE
)
Arguments
age_list |
A list containing all ROIs' true volumes, age trend estimates, and the fitted GAMLSS model. |
f |
A string specifying the feature of interest within the |
s |
A string indicating the demographic group for visualization: |
q |
A string specifying the quantile type (e.g., |
cus_list |
A list object containing customized quantile predictions generated by the |
use_plotly |
A boolean indicating whether to create an interactive plot using |
Details
The function overlays true data points with predicted quantile trends for the specified feature and demographic group.
It supports customization for quantile visualization and uses precomputed results from the cus_result_gen
function
for enhanced flexibility.
Value
A plot object:
If
use_plotly = TRUE
, returns aplotly
interactive plot.If
use_plotly = FALSE
, returns aggplot2
static plot.
Examples
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))
customized_results <- cus_result_gen(age_list, customized_q = 0.75, f = "Volume_1")
if(interactive()){
age_trend_plot(
age_list = age_list,
f = "Volume_1",
s = "F",
q = "customization",
cus_list = customized_results,
use_plotly = TRUE
)
}