AFNI Message Board

Dear AFNI users-

We are very pleased to announce that the new AFNI Message Board framework is up! Please join us at:

https://discuss.afni.nimh.nih.gov

Existing user accounts have been migrated, so returning users can login by requesting a password reset. New users can create accounts, as well, through a standard account creation process. Please note that these setup emails might initially go to spam folders (esp. for NIH users!), so please check those locations in the beginning.

The current Message Board discussion threads have been migrated to the new framework. The current Message Board will remain visible, but read-only, for a little while.

Sincerely, AFNI HQ

History of AFNI updates  

|
December 09, 2002 04:14PM

Hello Barbara:

Both 3dfim+ and 3dDeconvolve, by default, fit a linear trend to the data
simultaneously with fitting the reference waveform. Therefore, if you use
either 3dfim+ or 3dDeconvolve, it is not necessary to remove the linear trend
from the input data. However, even if you do remove the linear trend first,
it does not matter if you average over the ROI first, or remove the linear
trend first and then average over the ROI.

Here are 4 different ways to calculate the same number (the output is from
a sample dataset; try this with your own data):

-------------------------------------------------------------------------------
1. First, average the time series over the region of interest, then detrend
the averaged time series, then calculate the cross-correlation:

3dmaskave -mask maskROI1+orig -quiet subject_3dtime+orig > ROI_average.1D
3dDeconvolve -input1D ROI_average.1D -nfirst 5 -num_stimts 0 \
-errts subject_detrend
3dfim+ -input1D subject_detrend.1D -nfirst 5 -ideal_file myRef.1D -out All

Results for Voxel #0:
Fit Coef = 389.7499
% Change = -196.2969
% From Ave = 1000.0000
Baseline = -198.5512
Average = 0.0002
Correlation = 0.5751 <<<<<<<<<<<<<<
% From Top = 203.8455
Topline = 191.1987
Sigma Resid = 278.5415

-------------------------------------------------------------------------------
2. First, detrend the 3d+time dataset, then average the time series over
the region of interest, then calculate the cross-correlation:

3dDeconvolve -input subject_3dtime+orig -nfirst 5 -num_stimts 0 \
-errts subject_detrend
3dmaskave -mask maskROI1+orig -quiet subject_detrend+orig > ROI_detrend.1D
3dfim+ -input1D ROI_detrend.1D -nfirst 5 -ideal_file myRef.1D -out All

Results for Voxel #0:
Fit Coef = 389.7747
% Change = -196.2997
% From Ave = 1000.0000
Baseline = -198.5610
Average = 0.0030
Correlation = 0.5751 <<<<<<<<<<<<<<
% From Top = 203.8425
Topline = 191.2136
Sigma Resid = 278.5365

-------------------------------------------------------------------------------
3. First, average the time series over the region of interest, do NOT detrend
the averaged time series before calculating the cross-correlation:

3dmaskave -mask maskROI1+orig -quiet subject_3dtime+orig > ROI_average.1D
3dfim+ -input1D ROI_average.1D -nfirst 5 -ideal_file myRef.1D -out All

Results for Voxel #0:
Fit Coef = 389.7499
% Change = 2.5564
% From Ave = 2.5236
Baseline = 15245.7549
Average = 15444.3066
Correlation = 0.5751 <<<<<<<<<<<<<<
% From Top = 2.4927
Topline = 15635.5049
Sigma Resid = 278.5415

-------------------------------------------------------------------------------
4. First, average the time series over the region of interest, do NOT detrend
the averaged time series before calculating the deconvolution fit:

3dmaskave -mask maskROI1+orig -quiet subject_3dtime+orig > ROI_average.1D
3dDeconvolve -input1D ROI_average.1D -nfirst 5 -num_stimts 1 \
-stim_file 1 myRef.1D

Results for Voxel #0:

Baseline:
t^0 coef = 15241.7734 t^0 t-st = 383.7979 p-value = 0.0000e+00
t^1 coef = 0.0294 t^1 t-st = 0.1313 p-value = 8.9563e-01

Stimulus: Stim #1
h[ 0] coef = 389.7499 h[ 0] t-st = 11.3793 p-value = 1.2044e-24
R^2 = 0.3308 F[ 1,262] = 129.4877 p-value = 1.2044e-24

Full Model:
MSE = 77585.3906
R^2 = 0.3308 F[ 1,262] = 129.4877 p-value = 1.2044e-24


To get the correlation coefficient, you have to calculate the square root
of R^2 (and attach the appropriate sign):
ccalc
calc> sqrt(0.3308)
= 0.575152 <<<<<<<<<<<<<<

-------------------------------------------------------------------------------

If you allow for multiple time lags, the input commands and the output from
programs 3dfim+ and 3dDeconvolve will differ.

Doug Ward
Subject Author Posted

detrend signal from ROI

Barbara Cerf-Ducastel December 09, 2002 12:40PM

Re: detrend signal from ROI

B. Douglas Ward December 09, 2002 04:14PM

Thanks!

Barbara Cerf-Ducastel December 09, 2002 05:06PM