Skip to contents

Build a GAM formula dynamically

Usage

build_formula(
  target,
  covariates,
  smooth_terms = NULL,
  group_by = "group",
  participant_id = "subjectID",
  k
)

Arguments

target

Diffusion metric to model

covariates

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

smooth_terms

Smoothing terms, 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

k

Dimension of the basis used to represent the node smoothing term

Value

A GAM formula

Examples

formula <- build_formula(target = "dti_fa",
                         covariates = c("group", "sex"),
                         k = 40)
formula <- build_formula(target = "dki_md",
                         covariates = c("group", "sex", "s(age, by=sex)"),
                         k = 32)