Skip to contents

Analyze group differences in a single dMRI tract profile using GAMs

Usage

tractable_single_bundle(
  df_afq,
  tract,
  dwi_metric,
  participant_id = "subjectID",
  group_by = "group",
  covariates = c(group_by),
  smooth_terms = NULL,
  k = "auto",
  family = "auto",
  ...
)

Arguments

df_afq

Input AFQ dataframe. If NULL, this function will load data using read_afq_files and the additional arguments in ...

tract

Abbreviated tract name, e.g., "CST_L" or "OR"

dwi_metric

The diffusion metric to model (e.g. "FA", "MD")

participant_id

The name of the column that encodes participant ID

group_by

The grouping variable used to group nodeID smoothing terms

covariates

List of strings of GAM covariates, not including the smoothing terms over nodes and the random effect due to subjectID.

smooth_terms

Smoothing terms, not including the smoothing terms over nodes and the random effect due to subjectID.

k

Dimension of the basis used to represent the node smoothing term, If k = 'auto', this function will attempt to find the best value

family

Distribution to use for the gam. Must be either 'gamma', 'beta', or 'auto'. If 'auto', this function will select the best fit between beta and gamma distributions.

...

Arguments to pass to fit_gam

Examples

sarica <- read_afq_sarica()
sarica$group <- factor(sarica$class)
sarica$subjectID <- unclass(factor(sarica$subjectID))
tractable_single_bundle(df_afq = sarica,
                     tract = "Right Corticospinal",
                     participant_id = "subjectID",
                     group_by = "group",
                     covariates = c("age","group"),
                     dwi_metric = "fa")
#> 
#> Family: Beta regression(61.146) 
#> Link function: logit 
#> 
#> Formula:
#> fa ~ age + group + s(nodeID, by = group, k = 16) + s(subjectID, 
#>     bs = "re")
#> 
#> Estimated degrees of freedom:
#> 14.5 14.4 37.9  total = 69.76 
#> 
#> fREML score: -6443.644