I usually report a group-level T-test image in the final publications or presentations. But in the early stage of a project when only one or a few subjects have been scanned, I often need to report an activation map for an individual subject after general linear model analysis (GLM). I could show a beta image or activation image, but a T-image is sometimes desired. The question is how do I calculate the T-value of a contrast for a single subject.
I will use the following example to show how it is calculated. Assume we have two conditions, beep and flash, and the brain signal is saved in y. Based on the timing of beep and flash, we have an independent variable called x with two columns. The 1st column is for beep, the 2nd for flash.
x=rand(10,2); y=x(:,1)*2 + x(:,2)*3 + 0.2 + rand(size(x(:,1)))/5; [a,b,c] = glmfit(x,y);
Now you can easily find the beta value, the T value, and the p-value of each individual condition:
beta = a(2:end)' T = c.t(2:end)' p = c.p(2:end)'
What about the contrast between beep and flash? Well, it’s a bit more complicated. First, we need to find the covariance matrix of the betas.
covb = c.covb(2:end, 2:end);
Then we define our contrast vector, in this case it is simply contrast = [1 -1]. The variance of contrast (beep-flash) is
V = contrast * covb * contrast';
The T-value of the contrast is
T = (beta * contrast') / sqrt(V) * sqrt(length(x));
Note: you might be tempted to use the two-sample T formula to calculate the T-value (i.e. finding the variance of beta1, variance of beta2, and then calculate). It is not the correct way. We have to consider the case where the two conditions are correlated. Using the covariance matrix above is the right way.