Plot GAM splines for each group
Usage
plot_gam_splines(
gam_model,
tract,
df_tract,
dwi_metric,
covariates,
group_by = "group",
participant_id = "subjectID",
out_dir
)
Arguments
- gam_model
GAM object, produced by gam/bam
- tract
AFQ tract name
- df_tract
A dataframe of AFQ nodes for certain tract
- dwi_metric
Diffusion MRI metric (e.g. FA, MD)
- covariates
List of strings of GAM covariates, not including the smoothing terms over nodes and the random effect due to subjectID.
- group_by
The grouping variable used to group nodeID smoothing terms
- participant_id
The name of the column that encodes participant ID
- out_dir
directory in which to save plots
Examples
if (FALSE) { # \dontrun{
df_afq <- read.csv("/path/to/afq/output.csv")
gam_fit <- fit_gam(df_afq,
target = "dti_fa",
covariates = list("group", "sex"),
family = "gamma",
k = 40)
plot_gam_splines(gam_model = gam_fit,
tract = "OR",
df_tract = df_afq,
dwi_metric = "dti_fa",
covariates = c("group", "sex"),
out_dir = ".")
} # }