nimare.meta.ibma

Image-based meta-analysis estimators

Classes

FFX_GLM([cdt, q, two_sided]) An image-based meta-analytic test using contrast and standard error images.
Fishers([two_sided]) An image-based meta-analytic test using t- or z-statistic images.
IBMAEstimator(*args, **kwargs) Base class for image-based meta-analysis methods.
MFX_GLM([cdt, q, two_sided]) The gold standard image-based meta-analytic test.
RFX_GLM([null, n_iters, two_sided]) A t-test on contrast images.
Stouffers([inference, null, n_iters, two_sided]) A t-test on z-statistic images.
WeightedStouffers([two_sided]) An image-based meta-analytic test using z-statistic images and sample sizes.

Functions

ffx_glm(con_maps, se_maps, sample_sizes, mask) Run a fixed-effects GLM on contrast and standard error images.
fsl_glm(con_maps, se_maps, sample_sizes, …) Run a GLM with FSL.
mfx_glm(con_maps, se_maps, sample_sizes, mask) Run a mixed-effects GLM on contrast and standard error images.
class FFX_GLM(cdt=0.01, q=0.05, two_sided=True, *args, **kwargs)[source]

An image-based meta-analytic test using contrast and standard error images. Don’t estimate variance, just take from first level.

Parameters:
  • cdt (float, optional) – Cluster-defining p-value threshold.
  • q (float, optional) – Alpha for multiple comparisons correction.
  • two_sided (bool, optional) – Whether analysis should be two-sided (True) or one-sided (False).

Methods

fit(self, dataset) Fit Estimator to Dataset.
get_params(self[, deep]) Get parameters for this estimator.
load(filename[, compressed]) Load a pickled class instance from file.
save(self, filename[, compress]) Pickle the class instance to the provided file.
set_params(self, \*\*params) Set the parameters of this estimator.
fit(self, dataset)[source]

Fit Estimator to Dataset.

Parameters:dataset (nimare.dataset.Dataset) – Dataset object to analyze.
Returns:Results of Estimator fitting.
Return type:nimare.results.MetaResult
get_params(self, deep=True)[source]

Get parameters for this estimator.

Parameters:deep (boolean, optional) – If True, will return the parameters for this estimator and contained subobjects that are estimators.
Returns:params – Parameter names mapped to their values.
Return type:mapping of string to any
classmethod load(filename, compressed=True)[source]

Load a pickled class instance from file.

Parameters:
  • filename (str) – Name of file containing object.
  • compressed (bool, optional) – If True, the file is assumed to be compressed and gzip will be used to load it. Otherwise, it will assume that the file is not compressed. Default = True.
Returns:

obj – Loaded class object.

Return type:

class object

save(self, filename, compress=True)[source]

Pickle the class instance to the provided file.

Parameters:
  • filename (str) – File to which object will be saved.
  • compress (bool, optional) – If True, the file will be compressed with gzip. Otherwise, the uncompressed version will be saved. Default = True.
set_params(self, **params)[source]

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Returns:
Return type:self
class Fishers(two_sided=True, *args, **kwargs)[source]

An image-based meta-analytic test using t- or z-statistic images. Requires z-statistic images, but will be extended to work with t-statistic images as well.

Parameters:two_sided (bool, optional) – Whether to do a two- or one-sided test. Default is True.

Notes

Sum of -log P-values (from T/Zs converted to Ps)

Methods

fit(self, dataset) Fit Estimator to Dataset.
get_params(self[, deep]) Get parameters for this estimator.
load(filename[, compressed]) Load a pickled class instance from file.
save(self, filename[, compress]) Pickle the class instance to the provided file.
set_params(self, \*\*params) Set the parameters of this estimator.
fit(self, dataset)[source]

Fit Estimator to Dataset.

Parameters:dataset (nimare.dataset.Dataset) – Dataset object to analyze.
Returns:Results of Estimator fitting.
Return type:nimare.results.MetaResult
get_params(self, deep=True)[source]

Get parameters for this estimator.

Parameters:deep (boolean, optional) – If True, will return the parameters for this estimator and contained subobjects that are estimators.
Returns:params – Parameter names mapped to their values.
Return type:mapping of string to any
classmethod load(filename, compressed=True)[source]

Load a pickled class instance from file.

Parameters:
  • filename (str) – Name of file containing object.
  • compressed (bool, optional) – If True, the file is assumed to be compressed and gzip will be used to load it. Otherwise, it will assume that the file is not compressed. Default = True.
Returns:

obj – Loaded class object.

Return type:

class object

save(self, filename, compress=True)[source]

Pickle the class instance to the provided file.

Parameters:
  • filename (str) – File to which object will be saved.
  • compress (bool, optional) – If True, the file will be compressed with gzip. Otherwise, the uncompressed version will be saved. Default = True.
set_params(self, **params)[source]

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Returns:
Return type:self
class IBMAEstimator(*args, **kwargs)[source]

Base class for image-based meta-analysis methods.

Methods

fit(self, dataset) Fit Estimator to Dataset.
get_params(self[, deep]) Get parameters for this estimator.
load(filename[, compressed]) Load a pickled class instance from file.
save(self, filename[, compress]) Pickle the class instance to the provided file.
set_params(self, \*\*params) Set the parameters of this estimator.
fit(self, dataset)[source]

Fit Estimator to Dataset.

Parameters:dataset (nimare.dataset.Dataset) – Dataset object to analyze.
Returns:Results of Estimator fitting.
Return type:nimare.results.MetaResult
get_params(self, deep=True)[source]

Get parameters for this estimator.

Parameters:deep (boolean, optional) – If True, will return the parameters for this estimator and contained subobjects that are estimators.
Returns:params – Parameter names mapped to their values.
Return type:mapping of string to any
classmethod load(filename, compressed=True)[source]

Load a pickled class instance from file.

Parameters:
  • filename (str) – Name of file containing object.
  • compressed (bool, optional) – If True, the file is assumed to be compressed and gzip will be used to load it. Otherwise, it will assume that the file is not compressed. Default = True.
Returns:

obj – Loaded class object.

Return type:

class object

save(self, filename, compress=True)[source]

Pickle the class instance to the provided file.

Parameters:
  • filename (str) – File to which object will be saved.
  • compress (bool, optional) – If True, the file will be compressed with gzip. Otherwise, the uncompressed version will be saved. Default = True.
set_params(self, **params)[source]

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Returns:
Return type:self
class MFX_GLM(cdt=0.01, q=0.05, two_sided=True, *args, **kwargs)[source]

The gold standard image-based meta-analytic test. Uses contrast and standard error images.

Parameters:
  • cdt (float, optional) – Cluster-defining p-value threshold.
  • q (float, optional) – Alpha for multiple comparisons correction.
  • two_sided (bool, optional) – Whether analysis should be two-sided (True) or one-sided (False).

Methods

fit(self, dataset) Fit Estimator to Dataset.
get_params(self[, deep]) Get parameters for this estimator.
load(filename[, compressed]) Load a pickled class instance from file.
save(self, filename[, compress]) Pickle the class instance to the provided file.
set_params(self, \*\*params) Set the parameters of this estimator.
fit(self, dataset)[source]

Fit Estimator to Dataset.

Parameters:dataset (nimare.dataset.Dataset) – Dataset object to analyze.
Returns:Results of Estimator fitting.
Return type:nimare.results.MetaResult
get_params(self, deep=True)[source]

Get parameters for this estimator.

Parameters:deep (boolean, optional) – If True, will return the parameters for this estimator and contained subobjects that are estimators.
Returns:params – Parameter names mapped to their values.
Return type:mapping of string to any
classmethod load(filename, compressed=True)[source]

Load a pickled class instance from file.

Parameters:
  • filename (str) – Name of file containing object.
  • compressed (bool, optional) – If True, the file is assumed to be compressed and gzip will be used to load it. Otherwise, it will assume that the file is not compressed. Default = True.
Returns:

obj – Loaded class object.

Return type:

class object

save(self, filename, compress=True)[source]

Pickle the class instance to the provided file.

Parameters:
  • filename (str) – File to which object will be saved.
  • compress (bool, optional) – If True, the file will be compressed with gzip. Otherwise, the uncompressed version will be saved. Default = True.
set_params(self, **params)[source]

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Returns:
Return type:self
class RFX_GLM(null='theoretical', n_iters=None, two_sided=True, *args, **kwargs)[source]

A t-test on contrast images. Requires contrast images.

Parameters:
  • null ({'theoretical', 'empirical'}, optional) – Whether to use a theoretical null T distribution or an empirically- derived null distribution determined via sign flipping. Default is ‘theoretical’.
  • n_iters (int or None, optional) – The number of iterations to run in estimating the null distribution. Only used if null = 'empirical'.
  • two_sided (bool, optional) – Whether to do a two- or one-sided test. Default is True.

Methods

fit(self, dataset) Fit Estimator to Dataset.
get_params(self[, deep]) Get parameters for this estimator.
load(filename[, compressed]) Load a pickled class instance from file.
save(self, filename[, compress]) Pickle the class instance to the provided file.
set_params(self, \*\*params) Set the parameters of this estimator.
fit(self, dataset)[source]

Fit Estimator to Dataset.

Parameters:dataset (nimare.dataset.Dataset) – Dataset object to analyze.
Returns:Results of Estimator fitting.
Return type:nimare.results.MetaResult
get_params(self, deep=True)[source]

Get parameters for this estimator.

Parameters:deep (boolean, optional) – If True, will return the parameters for this estimator and contained subobjects that are estimators.
Returns:params – Parameter names mapped to their values.
Return type:mapping of string to any
classmethod load(filename, compressed=True)[source]

Load a pickled class instance from file.

Parameters:
  • filename (str) – Name of file containing object.
  • compressed (bool, optional) – If True, the file is assumed to be compressed and gzip will be used to load it. Otherwise, it will assume that the file is not compressed. Default = True.
Returns:

obj – Loaded class object.

Return type:

class object

save(self, filename, compress=True)[source]

Pickle the class instance to the provided file.

Parameters:
  • filename (str) – File to which object will be saved.
  • compress (bool, optional) – If True, the file will be compressed with gzip. Otherwise, the uncompressed version will be saved. Default = True.
set_params(self, **params)[source]

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Returns:
Return type:self
class Stouffers(inference='ffx', null='theoretical', n_iters=None, two_sided=True, *args, **kwargs)[source]

A t-test on z-statistic images. Requires z-statistic images.

Parameters:
  • inference ({'ffx', 'rfx'}, optional) – Whether to use fixed-effects inference (default) or random-effects inference.
  • null ({'theoretical', 'empirical'}, optional) – Whether to use a theoretical null T distribution or an empirically- derived null distribution determined via sign flipping. Empirical null is only possible if inference = 'rfx'.
  • n_iters (int or None, optional) – The number of iterations to run in estimating the null distribution. Only used if inference = 'rfx' and null = 'empirical'.
  • two_sided (bool, optional) – Whether to do a two- or one-sided test. Default is True.

Methods

fit(self, dataset) Fit Estimator to Dataset.
get_params(self[, deep]) Get parameters for this estimator.
load(filename[, compressed]) Load a pickled class instance from file.
save(self, filename[, compress]) Pickle the class instance to the provided file.
set_params(self, \*\*params) Set the parameters of this estimator.
fit(self, dataset)[source]

Fit Estimator to Dataset.

Parameters:dataset (nimare.dataset.Dataset) – Dataset object to analyze.
Returns:Results of Estimator fitting.
Return type:nimare.results.MetaResult
get_params(self, deep=True)[source]

Get parameters for this estimator.

Parameters:deep (boolean, optional) – If True, will return the parameters for this estimator and contained subobjects that are estimators.
Returns:params – Parameter names mapped to their values.
Return type:mapping of string to any
classmethod load(filename, compressed=True)[source]

Load a pickled class instance from file.

Parameters:
  • filename (str) – Name of file containing object.
  • compressed (bool, optional) – If True, the file is assumed to be compressed and gzip will be used to load it. Otherwise, it will assume that the file is not compressed. Default = True.
Returns:

obj – Loaded class object.

Return type:

class object

save(self, filename, compress=True)[source]

Pickle the class instance to the provided file.

Parameters:
  • filename (str) – File to which object will be saved.
  • compress (bool, optional) – If True, the file will be compressed with gzip. Otherwise, the uncompressed version will be saved. Default = True.
set_params(self, **params)[source]

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Returns:
Return type:self
class WeightedStouffers(two_sided=True, *args, **kwargs)[source]

An image-based meta-analytic test using z-statistic images and sample sizes. Zs from bigger studies get bigger weights.

Parameters:two_sided (bool, optional) – Whether to do a two- or one-sided test. Default is True.

Methods

fit(self, dataset) Fit Estimator to Dataset.
get_params(self[, deep]) Get parameters for this estimator.
load(filename[, compressed]) Load a pickled class instance from file.
save(self, filename[, compress]) Pickle the class instance to the provided file.
set_params(self, \*\*params) Set the parameters of this estimator.
fit(self, dataset)[source]

Fit Estimator to Dataset.

Parameters:dataset (nimare.dataset.Dataset) – Dataset object to analyze.
Returns:Results of Estimator fitting.
Return type:nimare.results.MetaResult
get_params(self, deep=True)[source]

Get parameters for this estimator.

Parameters:deep (boolean, optional) – If True, will return the parameters for this estimator and contained subobjects that are estimators.
Returns:params – Parameter names mapped to their values.
Return type:mapping of string to any
classmethod load(filename, compressed=True)[source]

Load a pickled class instance from file.

Parameters:
  • filename (str) – Name of file containing object.
  • compressed (bool, optional) – If True, the file is assumed to be compressed and gzip will be used to load it. Otherwise, it will assume that the file is not compressed. Default = True.
Returns:

obj – Loaded class object.

Return type:

class object

save(self, filename, compress=True)[source]

Pickle the class instance to the provided file.

Parameters:
  • filename (str) – File to which object will be saved.
  • compress (bool, optional) – If True, the file will be compressed with gzip. Otherwise, the uncompressed version will be saved. Default = True.
set_params(self, **params)[source]

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Returns:
Return type:self
ffx_glm(con_maps, se_maps, sample_sizes, mask, cdt=0.01, q=0.05, work_dir='ffx_glm', two_sided=True)[source]

Run a fixed-effects GLM on contrast and standard error images.

Parameters:
  • con_maps ((n_contrasts, n_voxels) numpy.ndarray) – A 2D array of contrast maps in the same space, after masking.
  • var_maps ((n_contrasts, n_voxels) numpy.ndarray) – A 2D array of contrast standard error maps in the same space, after masking. Must match shape and order of con_maps.
  • sample_sizes ((n_contrasts,) numpy.ndarray) – A 1D array of sample sizes associated with contrasts in con_maps and var_maps. Must be in same order as rows in con_maps and var_maps.
  • mask (nibabel.Nifti1Image) – Mask image, used to unmask results maps in compiling output.
  • cdt (float, optional) – Cluster-defining p-value threshold.
  • q (float, optional) – Alpha for multiple comparisons correction.
  • work_dir (str, optional) – Working directory for FSL flameo outputs.
  • two_sided (bool, optional) – Whether analysis should be two-sided (True) or one-sided (False).
Returns:

result – Dictionary containing maps for test statistics, p-values, and negative log(p) values.

Return type:

dict

fsl_glm(con_maps, se_maps, sample_sizes, mask, inference, cdt=0.01, q=0.05, work_dir='fsl_glm', two_sided=True)[source]

Run a GLM with FSL.

mfx_glm(con_maps, se_maps, sample_sizes, mask, cdt=0.01, q=0.05, work_dir='mfx_glm', two_sided=True)[source]

Run a mixed-effects GLM on contrast and standard error images.

Parameters:
  • con_maps ((n_contrasts, n_voxels) numpy.ndarray) – A 2D array of contrast maps in the same space, after masking.
  • var_maps ((n_contrasts, n_voxels) numpy.ndarray) – A 2D array of contrast standard error maps in the same space, after masking. Must match shape and order of con_maps.
  • sample_sizes ((n_contrasts,) numpy.ndarray) – A 1D array of sample sizes associated with contrasts in con_maps and var_maps. Must be in same order as rows in con_maps and var_maps.
  • mask (nibabel.Nifti1Image) – Mask image, used to unmask results maps in compiling output.
  • cdt (float, optional) – Cluster-defining p-value threshold.
  • q (float, optional) – Alpha for multiple comparisons correction.
  • work_dir (str, optional) – Working directory for FSL flameo outputs.
  • two_sided (bool, optional) – Whether analysis should be two-sided (True) or one-sided (False).
Returns:

result – Dictionary containing maps for test statistics, p-values, and negative log(p) values.

Return type:

dict