Another perhaps simple question: Is there a way to account for potential phase offsets during correlation? I guess what I have in my mind is:
- Circular shift each voxel time series until a maximum is reached for the correlation coefficient.
And an output of the max corr. coeff. with the offset phase shift would be great. Tried to do some quick searches in the board and couldn’t find anything. Any guidance with this would be very much appreciated. Thank you!
After reading a bit more of documentation it looks like ‘3dTshift’ does this a bit with the ‘-voxshift fset’ option. But requires an input data set. I’m curious if there are any other options to help determine this input option based on my above request. Any help is much appreciated. Thank you!
AFAICT, 3dTshift is not what you want. That’s for interpolating within a TR, so some weighted average between TR volumes. I take it you are interested in finding the lag, the number of TRs, that would give you a maximal correlation. You may be interested in a short script where you might just loop through a single TR offset (a little like your evens, odds question) with 3dTcorr1D. Within each loop, increment the offset and find the correlation. After all loops, find the maximal correlation with “3dTstat -absmax -argabsmax1” on the concatenated correlations to give you the maximal correlation and the offset+1 to that absolute maximum.
We used a similar approach as this one to look at stroke lesions with Gd-DSC and Iodine enhanced CT.
Other programs that can look at other kinds of lags are 3ddelay with Hilbert transforms, 1dGC.R with Granger causality.
Thank you so much for your input on this. That is very helpful and what you suggest is exactly my desire. A last question on implementing it; how do you shift time series? I’ve gone through some documentation (e.g. https://afni.nimh.nih.gov/pub/dist/doc/program_help/common_options.html) or even with the even/odd topic, and it hasn’t become apparent to me the command to shift a time series by one or n-number of steps? Any additional help with this would be greatly appreciated.
I would shift by using an incrementing index on the time series dataset, e.g. mydset"[$offset…$last]". I don’t think I would do wrap around the end. To make the lengths equal, you can set the variables, offset and last, to have a specified length that doesn’t go beyond the last volume.