I’m following this nilearn tutorial and was wondering if would be possible to model the first half of resting state data separately from the second half?
The seed_time_seriesarray([[-0.1719],[-0.2145],[-0.3262],...,[1.2215],[0.8738],[0.2069]]) has 176 values (88 in first half and 88 in second half).
My initial thought was to create two separate regressors like this:
vols – pcc1st – pcc_2nd
001 – -0.1719 – 0
002 – -0.2145 – 0
003 – -0.3262 – 0
…
174 – 0 – 1.2215
175 – 0 – 0.8738
176 – 0 – 0.2069
pcc_1st has zeros for vols>088 and pcc_2nd has zeros for vols<088, but this won’t work because the data are centered. Is there another way?
What you propose seems rather reasonable, but I fail to understand what your goal is in this analysis.
Another possibility would be to formally divide the 4D image into 2 4D images with half of the samples, and handle them as 2 different runs.
HTH,
Bertrand
Thanks @bthirion. I would like to analyze connectivity for different segments of the time series (for example, first 20 min vs last 20 min).
But isn’t it a problem that the data are centered? So a 0 doesn’t really represent absence but rather the mean of the time series.
Yes, I suppose that would work provided that I have the exact number of samples for each regressor. However, if I intend to analyse the first third against the last 2/3 of rest for example, this method will not work…
No, this is not a problem, since correlation measures are sensitive to variations around the mean. The mean-0 part will have no impact on correlation measure.
thanks @bthirion that was really very helpful. Just one more question, in centering, would you center the whole time series before or after dividing it into two halves?
For example, for the pcc_1st regressor in my example, would you (1) center the values from 001 to 176 and subsequently zero out the values ranging from 088 to 176, or (2) only center the values from 001 to 088 and zero out the rest?
@bthirion, suppose I have 150 volumes and I wish to model the first 50 and last 50 volumes in one run, and the middle 50 volumes in another run.
I divided my volumes in the 4D image into two separate runs:
Then I simply included the time-courses within my ROI for the first/last volumes (run_first_last) in one design matrix, and the time-courses for the middle volumes (run_middle) in another design matrix.
That’s great @bthirion, thanks! Regarding contrasts, with one session I can simply do first_level.compute_contrast([1, -1]). How can I do the same contrast with two sessions?
My design matrices look like these (reg1,reg2 and reg3 are confound regressors):
What this does is to estimate the two contrasts on the two runs sepaarately, and then to do a fixed effects on the contrasts. the computed parameters will indeed be the difference between the two parameters.
Best,