# confidence interval of betas in single subject

Hi AFNI team,

For a single subject, the stats file would have voxel-wise betas, t-stat and F-stat for each regressor (in my case, an experiment condition). With this information, how do I calculate a beta’s upper and lower bound of 95% confidence interval?

Thank you!

Try this:

1. Find the degrees of freedom for the t-stat sub-brick using a command like this (assuming the sub-brick number is 9):

3dAttribute BRICK_STATAUX myFile+tlrc’’

The last number is the degrees of freedom.

1. Compute the critical value corresponding to the p-value of, for example, 0.05 (DF is the degrees of freedom from 1) above):

cdf -p2t fitt 0.05 DF

1. Find out the upper bound of 95% uncertainty interval (assuming the critical value from 2) is CR and the beta and t-stat sub-bricks are 8 and 9):

3dcalc -a myFile+tlrc’’ -b myFile+tlrc’’ -expr ‘a+CR*a/b’ -prefix upper

and lower bound

3dcalc -a myFile+tlrc’’ -b myFile+tlrc’’ -expr ‘a-CR*a/b’ -prefix lower

Thanks Gang! This is very helpful!