age_trend_plot | R Documentation |
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
.
age_trend_plot(
age_list,
f,
s = "none",
q = "median",
cus_list = NULL,
use_plotly = TRUE
)
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 |
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.
A plot object:
If use_plotly = TRUE
, returns a plotly
interactive plot.
If use_plotly = FALSE
, returns a ggplot2
static plot.
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
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.