I need to find correlation of 3D+time with a time series I found function 3dTcorr1D which seems to do just that
I need to get the corrcoef along with the significances (or some stat that I can threshold for significance) in the description of function there is no mention of whether p values can be accesses ( e.g. looks like only 1 volume is returned per column of 1D input)
-pearson correlation option is mentioned to be a dot product. Is this calculated after subtracting the averages from to be correlated signals or should we demean the inputs before ourselves?
Ali, if you just have one time series to correlation the 3D+time dataset, check out step (4) on the following page: https://afni.nimh.nih.gov/SimAna
Also from the help of 3dTcorr1D:
- No detrending, blurring, or other pre-processing options are available;
if you want these things, see 3dDetrend or 3dBandpass or 3dcalc.
[In other words, this program presumes you know what you are doing!]
Jumping in for more fun…
- Gang’s suggestion of 3dDeconvolve or 3dfim+ can get you p-values,
or you could run cdf yourself. For example, if a time series of length 100
yields a correlation of 0.3, then the p-value might be 0.002426, from:
cdf -t2p fico .3 100 1 1
That assumes only demeaning the data (as is done with 3dTcorr1D).
If quadratic detrending were done, the ort-dof would be 3, leading to
a p-value of 0.00269, from:
cdf -t2p fico .3 100 1 3
See the output of “cdf -help” for details.
- 3dTcorr1D removes the mean, but does no trend removal.
Thank you my friends for suggestions and clarifications. I want to used 3dTcorr1D because I want to do multiple correlations at the same time ( i prefer to avoid for loops). signals to be correlated are concatenated 3D beta values from individual runs and a behavioral measure relevant for each run. so I do not need detrending.
In this case say I use z transform to calculate p values for correlations (probably using 3dcalc), I can then use this pvalue brick to threshold the correlations overlay (unless there is a better solution in afni?). Also may I suggest to add stats to 3dcorr1D in future? no one can report values without stats these days.
I ran 3dTcorr1D and realized it outputs p values that are shown in afni. That is what I was looking for so I do not have to calculate myself.