Builds a baseline model to account for noise and non-event-related variance. This model may include a drift term, a block intercept term, and nuisance regressors.
Arguments
- basis
Character; type of basis function ("constant", "poly", "bs", or "ns").
- degree
Integer; degree of the spline/polynomial function.
- sframe
A sampling_frame object.
- intercept
Character; whether to include an intercept ("runwise", "global", or "none"). Ignored when
basis == "constant"because the drift term already provides the constant baseline.- nuisance_list
Optional list of nuisance matrices or data frames (one per fMRI block).
- nuisance_check
Character; how to handle nuisance diagnostics.
"warn"warns on construction-time problems,"error"stops,"drop"removes non-finite, zero-variance, and rank-aliased columns with a warning, and"none"skips these checks.- na_action
Character; how to handle
NAvalues innuisance_listcolumns before the diagnostics run."drop"(default) leavesNAs in place so any column containing one is treated as non-finite and removed bynuisance_check."zero"replacesNAwith0(matching the fMRIPrep leading-row convention) and"median"replacesNAwith the column median; both repair an isolated leadingNA(e.g. in DVARS or framewise displacement) so the regressor is retained.NaNandInfare never repaired and remain subject to the non-finite drop. Repair is applied even whennuisance_check = "none", preventingNAs from leaking into the design matrix.
Examples
sframe <- fmrihrf::sampling_frame(blocklens = c(100, 100), TR = 2)
bmod <- baseline_model(basis = "bs", degree = 3, sframe = sframe)
bmod_global <- baseline_model(basis = "bs", degree = 3, sframe = sframe, intercept = "global")
bmod_nointercept <- baseline_model(basis = "bs", degree = 3, sframe = sframe, intercept = "none")
stopifnot(ncol(design_matrix(bmod)) == 8)