Differences between revisions 6 and 7
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
## Note: This page was created with the CommandTemplate
##
## If you're modifying this page please take a look at the
## latest version of CommandTemplate to ensure that you're
## using the latest version of the CommandTemplate
##
## See HelpOnCommandTemplate for description of formatting

'''Index'''
<<TableOfContents>>


= Name =
stxgrinder-sess - compute contrasts based on GeneralLinearModel

= Synopsis =
stxgrinder-sess - ??

= Arguments =
== Required Flagged Arguments ==
??

== Optional Flagged Arguments ==
||-a <analysisname> || session-level functional analysis name|| analysis as created by [[mkanalysis-sess.new]] and computed by [[selxavg-sess]] ||
||-c <contrast> [<-c contrast>] || contrasts||Contrast as created by [[mkcontrast-sess]]. Multiple contrasts can be specified with multiple -c flags. This is a convenience only; the results will be exactly the same if the two contrasts are computed with separate calls to stxgrinder-sess. See also -all.||
||-all || compute all contrasts for given analysis||compute all contrasts found in the given analysis. The list is obtained based on all the .mat files in the project-level analysis directory.||
||-space <spacename> || space in which to average (native, tal, sph)||This is for running contrasts on group fixed-effects averages computed in the given space or on individuals after being resampled to the given space. Valid space names are tal (talairach) and sph (spherical). The hemi option becomes valid when the space is sph. See [[func2tal-sess]], [[func2sph-sess]], and [[isxavg-fe-sess]]. By default, the contrast is computed in the native functional space of subject.||
||-spacedir <spacedir> || space directory (default spacename)||By default, the name of the space subdirectory is just the same as the space name. In some cases, this can be changed (eg, with [[sphsmooth-sess]]). This option is the mechanism to specify what the new directory is.||
||-hemi <hemisphere> || with sph space <lh rh> || When the space is of type sph (ie, sphereical), then the data have been resampled onto the two cortical hemispheres separately (see [[func2sph-sess]]). By defalt, contrasts for both hemispheres will be computed. To run only one hemisphere, specify that hemisphere here with lh or rh. ||
||-fdofmax <dofmax> || max dof for F-test||set the max DOF used in F-test to dofmax (ie, if DOF > dofmax, the DOF is set to dofmax). Default is 1000. See BUGS below.||
|| -noftest || do not perform F-test. see BUGS below.||
||-sf <sessidfile> || ...|| ||
||-df <srchdirfile>|| ...|| ||
||-s <sessid> ||...|| ||
||-d <srchdir> ||...|| ||
||-help|| || ||
||-umask <umask> || set unix file permission mask|| ||
||-version || print version and exit|| ||

 
= Outputs =
||ces || Contrast Effect Size = C*bhat||
||cespct || ces expressed as a percentage of mean baseline||
||cesvar || variance of ces||
||t || t-ratio||
||sig || significance based on t-test||
||f || f-ratio (when J>1)||
||fsig || significance based on F-test (when J>1)||
||minsig || best significance, boferroni corrected (when J>1)||
||iminsig || index of best significance (when J>1)||

= Description =
== General ==
FsFast utility to compute contrasts for testing hypotheses based on a
GeneralLinearModel (GLM), including t and F statistics,
significances of those statistics, and contrast effects sizes
(ces).

== Algorithm ==
All the contrast outputs will be found in sess/analysis/contrast (for
native space) or sess/analysis/spacedir/contrast (for resampled).
Note: the significances are stored as -log10(p).

This program uses a univariate general linear model to compute the
contrasts:

y = X*b + n

where y is the raw data vector, X is the design matrix (the columns of
which are regressors), b is the vector of model parameters (regression
coefficients), and n noise. The noise is need not be white, but white will
be assumed for this discussion.

The best estimate of b is bhat = inv(X'*X)*X'*y, with residual
variance r = y - X*bhat. The residual variance is rvar = r'r/DOF,
where DOF is the number of rows of X minus the number of columns. bhat
and rvar are computed by selxavg-sess; both are stored in the h
volume. The X matrix can be found in the session-level analysis
directory in X.mat.

A contrast matrix C is a matrix with number of columns equal to the
number of columns in X. The contrast matrix is created by
mkcontrast-sess and can be found the the project-level analysis
directory (files with .mat). C can have any number of rows J. The
contrast effect size (CES) is then ces = C*bhat. The CES is saved
in the volume called ces. Note: there is also a volume called
cespct which is the CES as a percent of the mean functional value.

When J=1 (ie, there is only one row in C), the variance of the ces is
cesvar = rvar * (C * inv(X'*X) *C'). A t-statistic is formed by
t = ces/sqrt(cesvar), and the significance is computed. The result
is stored in volumes called t and sig, respectively.

When J>1 (ie, there multiple row in C), several things are done. First,
an F-ratio is computed as F = ces'*inv(C*inv(X'*X)*C')*ces/(J*rvar);
the signfificance of this ratio is also compued. The result
is stored in volumes called f and fsig, respectively. Second, a separate
t-test of performed for each row of C as described above; all results
are still stored in the t and sig volumes, but these volumes will have
J frames. Finally, the best (smallest) significance within the J
significances computed at a voxel is stored in minsig (after multiplication
by J as a bonferroni correction). The row as which the min sig was found
is stored in iminsig.

Note: the significances are stored as -log10(p). For t-tests, the signifiance
is given the same sign as the t-value.


== Notes ==

The significances are stored as -log10(p).

For t-tests, the signifiance is given the same sign as the t-value.

For F-tests, the signifiance is not given a sign. This is the only
difference with stxgrinder-sess.

t-test is not saved when contrast is omnibus or zomnibus

An "old" version of stxgrinder-sess is available as [[stxgrinder0-sess]].

= Examples =
== Example 1 ==
??

== Example 2 ==
??

= Bugs =
The program occasionally hangs when performing the F-test. This is
caused when the DOF is very large (eg, > 1000). This ofen happens
when analyzing group fixed effects. If the program appears to hang,
reduce FtestDOFMax with -fdofmax until it seems to run ok. You can
also just skip the F-test with -noftest.


= See Also =
[[mkanalysis-sess.new]], [[selxavg-sess]], [[mkcontrast-sess]]

= Links =
FreeSurfer, FsFast

= Methods Description =
{{{
description
description
}}}

= References =
[[References/Lastname###]]

= Reporting Bugs =
Report bugs to <analysis-bugs@nmr.mgh.harvard.edu>

= Author/s =
DougGreve