# T-Map

## Inputs

• Name of first metric/shape file.
• Name of second metric/shape file.
• Option to compute degrees of freedom.
• Option to compute P-Value.

## Outputs

• Name of output metric/shape file which will contain the mean from the first file, mean from the second file, the T-Statistic, optional degrees of freedom, and an optional P-Value.

## T-Statistic

• D1 (D2) = sample standard deviation of node's values in file 1 (2).
• N1 (N2) = number of columns in file 1 (2).
• M1 (M2) = mean of node's values in file 1 (2).
• T-Stat = (M1 - M2) / [((D1*D1) / N1) + ((D2*D2) / N2)]

## Degrees of freedom calculation (for each node)

• V1 (V2) = variance from the node's values in file 1 (2).
• N1 (N2) = number of columns in file 1 (2).
• NM1 (NM2)  = N1 - 1  (N2 - 1)
• numerator = V1/N1 + V2/N2
• denominator = (1.0 / NM1) * (V1/N1)^2 + (1.0 / NM2) * (V2/N2)^2
• Degrees of Freedom = numerator / denominator

## P-Value Computation

• Inputs are T-Stat and Degrees of Freedom
• If (T-Stat < 0  or  DOF > 1), P-Value = 1.0
• bb = lnbeta(0.5 * DOF, 0.5)    --- for  lnbeta find AFNI's mri_stats.c
• xx = DOF/(DOF + T-Stat*T-Stat)
• P-Value = incbeta(xx, 0.5*DOF, 0.5, bb);   --- for incbeta find AFNI's mri_stats.c

## Algorithm

• Compute the T-Statistic for each node.
• Compute optional Degrees of Freedom.
• Compute optional P-Value.