I am trying to do Beta correlation analysis (functional connectivity) but I seem to be stuck on the 3dDeconvolve part. I have been using as guides Andy Jahn’s youtube tutorial (https://www.youtube.com/watch?v=GNL30C9lyUQ) and an afni wiki (http://polaris.ssc.uwo.ca/mediawiki/index.php/AFNI_single_subject_stats#Multiple_Runs).
I have 17 conditions (ex. study phase + correct, study phase + incorrect, etc). Each subject has 6 runs. I have 28 subjects by am trying now to get the process working on at least one subject.
I have formatted my stim_times_IM files (.1D files) to be the time of each time that condition occurs (ex. study phase of a correct trial). Each row is a different run.
14.112 18.198 105.706 110.207 119.712 156.495 160.564 178.623 236.433
46.688 59.361 67.949 82.455 106.033 110.535 161.108 167.112 204.296 208.797 232.008
34.321 50.645 63.284 77.79 86.344 143.054 182.907 216.639 236.698
30.16 38.314 77.799 91.373 101.376 182.798 212.396 216.464
38.4 77.735 105.815 119.822 128.842 147.001 178.665 186.752 203.761 208.263 216.35
96.257 105.761 132.891 136.925 196.753
I started with using just one condition to get that working.
3dDeconvolve -input …/1028/epi/rscan01.nii …/1028/epi/rscan02.nii …/1028/epi/rscan03.nii …/1028/epi/rscan04.nii …/1028/epi/rscan05.nii …/1028/epi/rscan06.nii -num_stimts 1 -stim_times_IM 1 1028_study_scene_prev_correct.1D GAM -fout -tout -bucket testing2_stats
This seems to work without error. (However I do have the additional question of how I should choose which epi to feed in. Should it be the pre-processed rscan.nii or something else?)
Now I am attempting to add in different stim_times_IM files depending on condition. I tried using the following code.
3dDeconvolve -input …/1028/epi/scan01+orig.BRIK …/1028/epi/scan02+orig.BRIK …/1028/epi/scan03+orig.BRIK …/1028/epi/scan04+orig.BRIK …/1028/epi/scan05+orig.BRIK …/1028/epi/scan06+orig.BRIK
-xout -num_stimts 17 -polort 5
-stim_times_IM 1 1028_study_scene_prev_correct.1D ‘GAM’ -stim_label 1 StudCor
-stim_times_IM 2 1028_study_scene_prev_incorrect.1D ‘GAM’ -stim_label 2 StudIncor
-stim_times_IM 3 1028_test_scene_delay_correct.1D ‘GAM’ -stim_label 3 delayCor
-stim_times_IM 4 1028_test_scene_delay_incorrect.1D ‘GAM’ -stim_label 4 delayIncor
-stim_times_IM 5 1028_test_scene_delay_DPM.1D ‘GAM’ -stim_label 5 delayDPM
-stim_times_IM 6 1028_test_scene_delay_DPNM.1D ‘GAM’ -stim_label 6 delayDPNM
-stim_times_IM 7 1028_test_scene_delay_NDPV.1D ‘GAM’ -stim_label 7 delayNDPV
-stim_times_IM 8 1028_test_scene_face_correct.1D ‘GAM’ -stim_label 8 faceCor
-stim_times_IM 9 1028_test_scene_face_incorrect.1D ‘GAM’ -stim_label 9 faceIncor
-stim_times_IM 10 1028_test_scene_face_DPM.1D ‘GAM’ -stim_label 10 faceDPM
-stim_times_IM 11 1028_test_scene_face_DPNM.1D ‘GAM’ -stim_label 11 faceDPNM
-stim_times_IM 12 1028_test_scene_face_NDPV.1D ‘GAM’ -stim_label 12 faceNDPV
-stim_times_IM 13 1028_test_scene_prev_correct.1D ‘GAM’ -stim_label 13 prevCor
-stim_times_IM 14 1028_test_scene_prev_incorrect.1D ‘GAM’ -stim_label 14 prevIncor
-stim_times_IM 15 1028_test_scene_prev_DPM.1D ‘GAM’ -stim_label 15 prevDPM
-stim_times_IM 16 1028_test_scene_prev_DPNM.1D ‘GAM’ -stim_label 16 prevDPNM
-stim_times_IM 17 1028_test_scene_prev_NDPV.1D ‘GAM’ -stim_label 17 prevNDPV
-fout -tout -bucket testrun_stats4FC
I get the following output /error.
++ ‘-stim_times_IM 1 1028_study_scene_prev_correct.1D’ will have 53 regressors
++ ‘-stim_times_IM 2 1028_study_scene_prev_incorrect.1D’ will have 42 regressors
++ ‘-stim_times_IM 3 1028_test_scene_delay_correct.1D’ will have 53 regressors
++ ‘-stim_times_IM 4 1028_test_scene_delay_incorrect.1D’ will have 42 regressors
++ ‘-stim_times_IM 5 1028_test_scene_delay_DPM.1D’ will have 36 regressors
++ ‘-stim_times_IM 6 1028_test_scene_delay_DPNM.1D’ will have 28 regressors
** ERROR: 3dDeconvolve dies: Unrecognized command line option: ‘7’
Here’s hoping these excerpts from ‘3dDeconvolve -help’ enlighten:
‘37 => remove global time index #37’
‘for a 17 second stimulus. [09 Aug 2010]’
‘global time index 47; it does NOT mean’
I have been trouble shooting for a while but can’t seem to figure out what is going wrong here.
Any help you can offer will be very much appreciated! And I’ll do my best to pay it forward
Okay. I see now that the error was because there was no space between the stim_label name and the .
However, I did get another error.
*+ WARNING: +++++ !! Matrix inverse average error = 0.00115008 ** BEWARE **
++ Matrix setup time = 1870.44 s
** ERROR: !! 3dDeconvolve: Can’t run past 288 matrix warnings without ‘-GOFORIT 288’
** ERROR: !! Currently at -GOFORIT 0
** ERROR: !! See file 3dDeconvolve.err for all WARNING and ERROR messages !!
** ERROR: !! Be sure you understand what you are doing before using -GOFORIT !!
** ERROR: !! If in doubt, consult with someone or with the AFNI message board !!
** FATAL ERROR: !! 3dDeconvolve (regretfully) shuts itself down !!
** Program compile date = Aug 31 2012
Should I use GOFORIT 288 or does that mean there is something else wrong that needs fixing?
How much data do you have in the 6 runs? The sample timing file you give has 53 events. Times 17 cases is about 900 betas to estimate (plus the 36 baseline betas). That is a lot! You need a lot of data to make that feasible.
Thank you for your reply.
I’m not sure I understand. Each event (time in the stim_times_IM) file is the onset time for a trial under which that condition is true.
Ex. run 1 at 14.1 seconds, 18.2 seconds and so on, marks the start of the study phase for trials that the participant gives the correct response.
To do Beta correlations don’t I need to create one Beta per event? How do I have more data than one functional scan per run? Or is the issue that for 17 conditions, I would need more than 53 trials per condition?
Sorry for not understanding but to answer your question, I have 28 subjects, each with 6 blocks of 16 trials each (96*28=2688).
Please let me know if you need to know anything else!
Hi Dr. Cox,
Just writing to see if you had further tips on this matter.
Afni is giving me warnings (following) ensuring I really know what I am doing. However I am not entirely sure that is the case. I am getting a lot of warnings about high co-linearity. So perhaps I have this set up wrong?
Thanks for any help you can offer!
WARNING: +++++ !! Matrix inverse average error = 0.00115008 ** BEWARE **
++ Matrix setup time = 1492.75 s
*+ WARNING: !! 3dDeconvolve -GOFORIT is set to 288: running despite 288 matrix warnings
*+ WARNING: !! See file 3dDeconvolve.err for all WARNING and ERROR messages !!
*+ WARNING: !! Please be sure you understand what you are doing !!
*+ WARNING: !! If in doubt, consult with someone or with the AFNI message board !!
++ current memory malloc-ated = 7,728,341,220 bytes (about 7.7 billion)
Let me ask a few questions to try and clear this up.
But note that the number of subjects is irrelevant so
far. This discussion is just about the single subject
linear regression, which you might be overspecifying.
There are 96 events per trial type, is that right?
And how many trial types are there (with 96 events)?
How many time points are there per run?
What is the TR?
Okay I see.
Yes I agree number of subjects should be irrelevant at this point.
The experiment works by showing 48 scene face pairings, and testing 1/3 of these scenes (16 test trials). This is repeated over 6 blocks.
So 96 is actually the number of trials tested total (16 * 6 blocks).
The different conditions are moderately complicated (and could be simplified somewhat if need be). The conditions are broken down by both phase of experiment and accuracy. The 4 phases are the study phase, the test cue, a test delay, and a test response period. Their durations are 3s, 1s, 7s, 3s, respectively. At a TR of 1770ms these periods have slice numbers of 1.7, 0.56, 3.95, and 1.7 respectively. (Is that the issue that there are too few time points for a correlation to be computed?). The accuracy of the experiment is done in multiple ways based on multiple ways for a participant to respond (complicated but the takeaway is that they total to more than 96 as there is significant overlap). In general the number of trials available for each condition is in the 20s to 50s. Is that enough?
Thank you very much and please let me know if there are any other details I could provide to be clearer.
The program does not yet know what the TR is, and that
causes issues with 1D input. Add “-force_TR 1.0” before
the -input option and see how that goes.
Thanks! Unfortunately this still throws so many warnings that 3dDeconvolve can’t run without “-GOFORIT”. The warnings may look different this time (although there are so many I’m not sure what all of them said last time). The warnings say "run#x has y times outside range 0 … 345 [PFSB syndrome] and "column x [name] is all zeros, and that the columns are “nearly collinear” .
Could part of the problem be the TR is 1.77 not 1.0?
Your help is much appreciated!
Yes, sorry. Please use the correct TR there.
Note that 3dDeconvolve cannot tell the TR from a 1D file,
so it should be provided separately.
Unfortunately that is leading to the same warnings I was obtaining earlier (example below. After 288 of these shuts itself down as I haven’t been using “GOFORIT”).
*+ WARNING: !! * Columns 607 [prevIncor#41] and 703 [prevNDPV#31] are nearly collinear!
From what I have described above am I on the right track or do you think there is something fundamentally wrong with what I am trying to do?
Thanks for your help and support!