respecify_l2_models_by_subject: Helper function to run the requested GLM model for each...

View source: R/glm_helper_functions.R

respecify_l2_models_by_subjectR Documentation

Helper function to run the requested GLM model for each subject+session separately

Description

Helper function to run the requested GLM model for each subject+session separately

Usage

respecify_l2_models_by_subject(mobj, data)

Arguments

mobj

an l1_model_spec or hi_model_spec object containing the GLM model to run

data

The run-level data frame containing data for all ids and sessions. This will be split into individual chunks

Details

The function adds the $by_subject field, which contains the design matrices and contrasts for each subject and session in data based on the available data for that session. For example, if a subject is missing a few runs (or these are dropped from analysis), then some contrasts may change or drop out of the model.

The $by_subject field is a keyed data.table object containing list elements for the cope_list (mapping cope numbers to contrast names), the contrasts, and the design matrix for each session.

Value

a modified copy of mobj where the $by_subject field has been added


UNCDEPENdLab/fmri.pipeline documentation built on April 3, 2025, 3:21 p.m.