Skip to content

AFNI and NIfTI Server for NIMH/NIH/PHS/DHHS/USA/Earth

Sections
Personal tools
You are here: Home » FAQs » How can I do a t-test on time series data?

How can I do a t-test on time series data?

Document Actions
Up to table of contents

Q52. How can I do a t-test on time series data?
There are two possible ways to do intra-dataset comparisons to get a t-test result. The first is to use program 3dttest. At present, this requires breaking the input dataset into pieces, 1 sub-brick per dataset, since 3dttest can only read 1 sub-brick datasets. You could do this break up with the command line program 3dbucket, used once for each sub-brick to be extracted. This would be ugly, but possible.

The second way is to use the FIM analysis with the ideal set to be equal to 1 for the "on" periods and equal to 0 for the "off" periods. A correlation with such a 0-1 valued ideal function is mathematically equivalent to a t-test between the "on" and "off" time points. The correlation coefficient that is returned can be converted to a t-statistic via the formula

  t = sqrt(n) * r/sqrt(1-r*r)
  where r = correlation coefficient
  n = number of degrees of freedom = N-2
  N = number of points in the time series used in the analysis.
There is no particular reason to do this conversion, since the results of a correlation analysis are statistically identical, and since AFNI will show the nominal p-value for either type of statistic.

[Later]: If you are doing a correlation with multiple ideals, then the program assumes you are approximately optimizing over a 1 dimensional set of functions. This changes the distribution - it is no longer equivalent to a t-test after the above transformation. Instead, if you want to convert the correlation coefficient to some more familiar statistic, you should use the equation

  Nt-Nort-Nfit     r**2
  ------------ * -------- = F(Nfit,Nt-Nort-Nfit)
  Nfit         1-r**2
  where
  Nt   = number of points in time series used in correlation
  Nfit = number of fitting dimensions (1 or 2 in FIM)
  Nort = number of "orts" (2 in the default setup)
(assuming the null hypothesis that the time series consists of Nt samples of i.i.d. N(0,1) deviates).

[Answer last changed 28 Feb 2000]

This FAQ applies to: Any version.

Created by Robert Cox
Last modified 2005-08-01 14:18
 

Powered by Plone

This site conforms to the following standards: