Converts per-run confound matrices and time weights into orthonormal projectors
that can be consumed directly by the C++ graph builder. Each run produces
\(Q_k\) (columns spanning the weighted confound space) and \(\sqrt{w_k}\)
(per-time-point square-root weights). Supplying a NULL confound matrix
yields a zero-column projector, enabling pure time-weighting without
regression.
prepare_confounds(
confounds,
time_weights = NULL,
run_lengths,
include_intercept = TRUE,
center_cols = TRUE,
scale_cols = FALSE
)A list with elements Q_list (list of matrices) and
sqrtw_list (list of numeric vectors). Each entry has the same length
as run_lengths.
List of matrices (\(T_k \times p_k\)), or a single matrix reused for all runs. Each row corresponds to a time point.
Optional list of numeric vectors (length \(T_k\)) or a
single vector reused for every run. If NULL, unit weights are used.
Integer vector with the number of time points per run.
Required when any run has both confounds=NULL and time_weights=NULL.
Logical; prepend a column of ones before QR (default TRUE).
Logical; center each confound column before weighting (default TRUE).
Logical; scale columns to unit variance before weighting (default FALSE).