This is an old revision of the document!
Table of Contents
MDM::ComputeGLM - compute a random-effects suitable GLM (regression)
Motivation
To combine several subjects' data into one compound analysis, it is custom to compute random-effects statistics on the second level. The MDM file format of BrainVoyager QX references the required time-course files (VTC or MTC) and the respective information containing the model (onsets in PRT files or regressors in SDM files).
This method then allows to perform the regression on a session-by-session basis and combine the results in one compound GLM object.
Requirements
This function is currently implemented for BrainVoyager QX's GLM format only. The following files must be available:
- VTC (or MTC) files for all runs of all subjects (e.g. the ones automatically created by spm5_preprojobs, for how to name files see below)
- optionally the realignment parameter files (supported formats: TXT for SPM rp*.txt files, SDM for BV's motion correction output)
Note: The combination of within-subjects regressors (e.g. same condition across several runs) is done by identifying the subject ID as the particle of the time-course filename before the first underscore character! This means that VTC (or MTC) filenames must be named as follows:
- SUBJ1_RUNorTASK1.vtc
- SUBJ1_RUNorTASK2.vtc
- SUBJ1_ …
- SUBJ2_RUNorTASK1.vtc
- SUBJ2_RUNorTASK2.vtc
- …
The number of runs per subject can be different (although, for the sake of having the error on beta estimates coming from the same distribution, it is suggested to use roughly the same number of volumes–and usually runs–for all subjects), and also the names after the first underscore need not match across subjects (in fact, it needn't be unique, which of course is highly recommended for the user to be able to distinguish time-course files!). The following is thus a valid naming scheme:
jd3512_r48217.vtc jd3512_r48218.vtc jd3512_r48219.vtc pk5199_r89112.vtc pk5199_r89113.vtc
Reference / mdm.Help('ComputeGLM')
MDM::ComputeGLM - compute a GLM from an MDM file FORMAT: glm = mdm.ComputeGLM([options]) Input fields: options optional 1x1 struct with fields .globsigs add C components (of slices) as confounds (default: 0) .ithresh intensity threshold, default: 100 .loadglm boolean flag, load GLM file named in .outfile .mask optional masking, default: no mask (for now only VTC) .motpars motion parameters (Sx1 cell array with sdm/txt files) .motparsq also add squared motion parameters (default: false) .ndcreg if set > 0, perform deconvolution (only with PRTs!) .outfile output filename of GLM file, default: no saving .ppicond list of regressors (or differences) to interact .ppirob perform robust regression on VOI timecourse and remove outliers from timecourse/model (threshold, default: 0) .ppivoi VOI used to extract time-course from .prtpnorm normalize parameters of PRT.Conds (true) .regdiff flag, regress first discreet derivatives (diff) instead .restcond remove rest condition (rest cond. name, default: '') .robust perform robust instead of OLS regression .subsel cell array with subject IDs to work on .tfilter add filter regressors to SDMs (cut-off in secs) .tfilttype temporal filter type (either 'dct' or {'fourier'}) .vweight combine runs/studies variance-weighted (default: false) Output fields: glm GLM object Note: if RFX flag in MDM is set to true, predictor separation will be set to "Subjects". if .outfile is given, GLM is saved after each subject for robust regression models (to allow later continuation of crashed/broken computation using the .subsel field) for .ppi to work, the model filenames must be PRTs!
Usage examples
Starting from scratch, the user has to do the following steps:
- locate the filenames of the VTC (or MTC and SSM/TSM) files to be regressed
- optionally locate the filenames of the realignment parameter files
- make settings in the MDM structure
- pass optional settings to the ComputeGLM method call
- mdm_computeglm_sample.m
% locate filenames... cd /Projects/MAN1/Imaging/Subjects vtcs = findfiles([pwd '/M*/func'], '*.vtc', 'depth=1'); prts = findfiles([pwd '/M*/model'], '*.prt', 'depth=1'); if numel(vtcs) ~= numel(prts) error('Number of VTCs and PRTs must match!'); end % locate realignment parameter files rps = findfiles([pwd '/M*/func/r*'], 'rp*.txt', 'depth=1'); % create MDM mdm = xff('new:mdm'); mdm.RFX_GLM = 1; mdm.PSCTransformation = 1; mdm.NrOfStudies = numel(vtcs); mdm.XTC_RTC = [vtcs(:), prts(:)]; % optionally save MDM, .SaveAs without argument opens a dialog! % mdm.SaveAs; % ComputeGLM options opts = struct( ... 'motpars', {rps(:)}, ... 'restcond', 'rest', ... 'robust', true, ... 'tfilter', 160, ... 'tfilttype', 'fourier'); % compute GLM (robust takes a **LONG TIME** ! e.g. for each 200-Volume % run with 15 regressors between 30 and 60 minutes, depending on the % hardware used) glm = mdm.ComputeGLM(opts); % save GLM glm.SaveAs;