3dLSS design matrix input

Hi gurus!

I’ve spoken with a few of you about modeling single trial regressors with 3dDeconvolve and the stim_times_IM option for every trial. As an additional test, I’d like to model the trials separately using 3dLSS. I’d like to see how each apporach models single trial betas, before deciding which pipeline to use for a beta series correlation.

I already have the 3dDeconvolve down, however I am a bit unclear on the proper way to set up the design matrix before inputting it to 3dLSS (Even after reading the other message posts).

My major question is:
Can I input the matrix output from 3dDeconvolve (pasted below), where I have more than one stim_times_IM option, directly into 3dLSS? Will 3dLSS take that matrix and select one regressor at a time, while grouping the rest with the other nuisance regressors (and do so for each trial?)

I just want to make sure I do not need to change my 3dDeconvolve command to make unique design matrices for each individual trial. It follows that this would require me to run a 3dDeconvolve and 3dLSS command for each separate trial (i.e. several hundred times), rather than inputting the aforementioned single-trial design matrix and running 3dLSS just once.

My confusion stems greatly from this part of the 3dLSS documentation:


-matrix mmm = Read the matrix 'mmm', which should have been
                output from 3dDeconvolve via the '-x1D' option, and
                should have included exactly one '-stim_times_IM' option.

But as you’ll see below in my current 3dDeconvovle call, I have multiple stim_times_IM options, so that I can see which stimulus condition they belong to in the resulting single-trial sub-bricks of the stats file.

Advice on how to set up the Matrix using 3dD would be much appreciated! Because I’m all sorts of confused…


3dDeconvolve -input pb04.$subj.r*.blur+orig.HEAD                            \
    -censor censor_${subj}_combined_2.1D                                    \
    -ortvec mot_demean.r01.1D mot_demean_r01                                \
    -ortvec mot_demean.r02.1D mot_demean_r02                                \
    -ortvec mot_demean.r03.1D mot_demean_r03                                \
    -ortvec mot_demean.r04.1D mot_demean_r04                                \
    -ortvec mot_deriv.r01.1D mot_deriv_r01                                  \
    -ortvec mot_deriv.r02.1D mot_deriv_r02                                  \
    -ortvec mot_deriv.r03.1D mot_deriv_r03                                  \
    -ortvec mot_deriv.r04.1D mot_deriv_r04                                  \
    -polort 4                                                               \
    -local_times                                                            \
    -num_stimts 18                                                          \
    -stim_times_IM 1 stimuli/SR_enc_target_remembered.txt 'BLOCK(3,1)'      \
    -stim_label 1 enc_SR_TH                                                 \
    -stim_times_IM 2 stimuli/SR_enc_target_forgotten.txt 'BLOCK(3,1)'       \
    -stim_label 2 enc_SR_TM                                                 \
    -stim_times_IM 3 stimuli/SR_enc_lure_corrReject.txt 'BLOCK(3,1)'        \
    -stim_label 3 enc_SR_LCR                                                \
    -stim_times_IM 4 stimuli/SR_enc_lure_falseAlarm.txt 'BLOCK(3,1)'        \
    -stim_label 4 enc_SR_LFA                                                \
    -stim_times_IM 5 stimuli/SR_TH.txt 'BLOCK(3,1)'                         \
    -stim_label 5 retr_SR_TH                                                \
    -stim_times_IM 6 stimuli/SR_TM.txt 'BLOCK(3,1)'                         \
    -stim_label 6 retr_SR_TM                                                \
    -stim_times_IM 7 stimuli/SR_LCR.txt 'BLOCK(3,1)'                        \
    -stim_label 7 retr_SR_LCR                                               \
    -stim_times_IM 8 stimuli/SR_LFA.txt 'BLOCK(3,1)'                        \
    -stim_label 8 retr_SR_LFA                                               \
    -stim_times_IM 9 stimuli/OR_enc_target_remembered.txt 'BLOCK(3,1)'      \
    -stim_label 9 enc_OR_TH                                                 \
    -stim_times_IM 10 stimuli/OR_enc_target_forgotten.txt 'BLOCK(3,1)'      \
    -stim_label 10 enc_OR_TM                                                \
    -stim_times_IM 11 stimuli/OR_enc_lure_corrReject.txt 'BLOCK(3,1)'       \
    -stim_label 11 enc_OR_LCR                                               \
    -stim_times_IM 12 stimuli/OR_enc_lure_falseAlarm.txt 'BLOCK(3,1)'       \
    -stim_label 12 enc_OR_LFA                                               \
    -stim_times_IM 13 stimuli/OR_TH.txt 'BLOCK(3,1)'                        \
    -stim_label 13 retr_OR_TH                                               \
    -stim_times_IM 14 stimuli/OR_TM.txt 'BLOCK(3,1)'                        \
    -stim_label 14 retr_OR_TM                                               \
    -stim_times_IM 15 stimuli/OR_LCR.txt 'BLOCK(3,1)'                       \
    -stim_label 15 retr_OR_LCR                                              \
    -stim_times_IM 16 stimuli/OR_LFA.txt 'BLOCK(3,1)'                       \
    -stim_label 16 retr_OR_LFA                                              \
    -stim_times 17 stimuli/phase_instructions.txt 'BLOCK(3,1)'              \
    -stim_label 17 phase_instructions                                       \
    -stim_times 18 stimuli/NoResponse.txt 'BLOCK(3,1)'                      \
    -stim_label 18 NoResponse                                               \
    -GOFORIT 5                                                             \                  \
    -jobs 4                                                                 \
    -fout -tout -x1D X.xmat.1D -xjpeg X.jpg                                 \
    -x1D_uncensored X.nocensor.xmat.1D                                      \
    -fitts fitts.$subj                                                      \
    -errts errts.${subj}                                                    \
    -bucket stats.$subj

As a followup, and perhaps I have a better understanding now, but still confused:
This message board answer implies the best approach might be to create separate matrices for each condition of interest, where you have a separate 3dDeconvolve call for each condition, modeling only that specific condition with the stim_type_IM option. So, I SHOULD be creating 16 different matrices if I have 16 conditions of interest?
https://afni.nimh.nih.gov/afni/community/board/read.php?1,158154,158154#msg-158154

Furthermore, can 3dLSS take multiple runs as input like 3dDeconvolve? I cant figure out how to feed in more than one run.
-Should I be concatenating my separate pb04 files as input to 3dDeconvolve such that the design matrix treats everything as one long run?
-And if I do this, the runs should probably have been scaled (using the proc_py scale block) so that they each have an average mean of 100, correct?
Would this be kosher?
Otherwise with 4 runs each, and 16 conditions, that would mean having to run 3dLSS 64 times, right?

Hi there, bumping this since its been a minute!

Hello,

Did you ever figure this out? I have the same question. I have 8 different stimuli and 8 runs. Our input is a concatenation of the 8 runs using 3dTproject and we manually setup a -concat flag to tell 3dDeconvolve where the run breaks are for the 8 runs. I have 3dlss setup to loop through each stimulus and model only that specific condition with the stim_type_IM option.


        3dTproject -input $(ls ${data}/sub-${subject}_task-ThalHi_run-*space-MNI152NLin2009cAsym_desc-preproc_bold*.nii.gz | sort -V) \
        -mask combined_mask+tlrc.BRIK \
        -polort 3 \
        -ort nuisance.1D \
        -prefix errts.nii.gz

        3dDeconvolve -input errts.nii.gz \
        -concat '1D: 0 216 432 648 864 1080 1296 1512' \
        -mask combined_mask+tlrc.BRIK \
        -censor censor.1D \
        -x1D dcb.xmat.1D \
        -local_times \
        -num_stimts 8 \
        -stim_times_IM  1 $stimuli[$i].1D.txt 'TENT(6, 20.4, 9)' -stim_label 1 $stimuli[$i] \
        -stim_times  2 $stimuli[get_stimuli_index($i, 1)].1D.txt 'TENT(6, 20.4, 9)' -stim_label 2 $stimuli[get_stimuli_index($i, 1)] \
        -stim_times  3 $stimuli[get_stimuli_index($i, 2)].1D.txt 'TENT(6, 20.4, 9)' -stim_label 3 $stimuli[get_stimuli_index($i, 2)] \
        -stim_times  4 $stimuli[get_stimuli_index($i, 3)].1D.txt 'TENT(6, 20.4, 9)' -stim_label 4 $stimuli[get_stimuli_index($i, 3)] \
        -stim_times  5 $stimuli[get_stimuli_index($i, 4)].1D.txt 'TENT(6, 20.4, 9)' -stim_label 5 $stimuli[get_stimuli_index($i, 4)] \
        -stim_times  6 $stimuli[get_stimuli_index($i, 5)].1D.txt 'TENT(6, 20.4, 9)' -stim_label 6 $stimuli[get_stimuli_index($i, 5)] \
        -stim_times  7 $stimuli[get_stimuli_index($i, 6)].1D.txt 'TENT(6, 20.4, 9)' -stim_label 7 $stimuli[get_stimuli_index($i, 6)] \
        -stim_times  8 $stimuli[get_stimuli_index($i, 7)].1D.txt 'TENT(6, 20.4, 9)' -stim_label 8 $stimuli[get_stimuli_index($i, 7)] \
        -x1D_stop \
        -allzero_OK \
        -jobs 4

        3dLSS -input errts.nii.gz \
        -matrix dcb.xmat.1D \
        -prefix dcb.LSS \
        -overwrite -verb

I don’t have an answer for the 3dLSS question, but my suggestion is that, unless there is a strong multicollinearity problem, using 3dDeconvolve is much more preferable to dealing with 3dLSS.