← back to fmri_data methods ·
Object methods index ·
Recasting objects
One-sample t-test on every voxel of an fmri_data object. Returns a
statistic_image carrying t-statistics, two-tailed p-values, standard
errors, per-voxel sample sizes, and degrees of freedom — the canonical
group-level summary map for a set of contrast images. Optionally
thresholds the result before returning it.
statsimg = ttest(fmridat)
statsimg = ttest(fmridat, pvalthreshold, thresh_type)For a two-sample t-test, use fmri_data.regress
with a group indicator regressor.
| Argument | Type | Description |
|---|---|---|
fmridat |
fmri_data |
Object with one image per row of the (eventual) test. fmridat.dat is [voxels × images]. |
pvalthreshold |
numeric | Optional. p-value threshold (e.g. .05, .001, or a vector like [.001 .01 .05]). |
thresh_type |
string | Optional. 'uncorrected', 'fwe', or 'fdr'. Required if pvalthreshold is supplied. |
| Field | Type | Description |
|---|---|---|
statsimg.dat |
column | t-statistic per voxel. |
statsimg.p |
column | Two-tailed p-value per voxel. |
statsimg.ste |
column | Standard error per voxel. |
statsimg.N |
column | Number of non-NaN, non-zero observations per voxel. |
statsimg.dfe |
scalar | Degrees of freedom (n - 1). |
statsimg.volInfo |
struct | Inherited from fmridat.mask.volInfo so spatial position is preserved. |
The returned object is a statistic_image (subclass of image_vector) and
can be re-thresholded with statistic_image.threshold,
turned into a region object with region(...), displayed with
montage, surface, or orthviews, or registered into a layered
montage with canlab_results_fmridisplay.
- Two-tailed p-values are computed inside the
statistic_imageconstructor. - Voxels that are all-NaN or all-zero get
p = 1andt = 0so they will never survive a threshold. - For more elaborate designs (covariates, contrasts, robust regression),
use
fmri_data.regressinstead.
% Load 30 single-subject contrast images
imgs = load_image_set('emotionreg');
% QC: per-image montage and summary plots
slices(imgs);
plot(imgs);
% Voxelwise one-sample t-test (unthresholded)
t = ttest(imgs);
% Quick look at the unthresholded map
display_slices(t, 'axial'); colormap summer; colorbar;
% Layered slices + surfaces with registered handles
o2 = canlab_results_fmridisplay(t, 'full');
o2 = removeblobs(o2);
% Threshold and re-display the same montage
t = threshold(t, .005, 'unc');
o2 = addblobs(o2, region(t), 'nolegend');
orthviews(t);
% Re-threshold at q < .05 FDR and tabulate clusters
t = threshold(t, .05, 'fdr');
r = table(t);
montage(r, 'regioncenters', 'colormap');fmri_data.regress— voxelwise regression / two-sample t-teststatistic_image.threshold— re-threshold the returned t-mapfmri_data.predict— multivariate alternative to mass-univariate testingfmri_data.table— tabulate clusters of a thresholded mapfmri_data.descriptives— summary statistics on the input images
