nimare.meta.cbma.mkda
.MKDAChi2
- class MKDAChi2(kernel_transformer=<class 'nimare.meta.kernel.MKDAKernel'>, prior=0.5, **kwargs)[source]
Bases:
nimare.meta.cbma.base.PairwiseCBMAEstimator
Multilevel kernel density analysis- Chi-square analysis.
Changed in version 0.0.8:
[REF] Use saved MA maps, when available.
- Parameters
kernel_transformer (
KernelTransformer
, optional) – Kernel with which to convolve coordinates from dataset. Default isMKDAKernel
.prior (float, optional) – Uniform prior probability of each feature being active in a map in the absence of evidence from the map. Default: 0.5
**kwargs – Keyword arguments. Arguments for the kernel_transformer can be assigned here, with the prefix ‘kernel__’ in the variable name.
- Variables
~MKDAChi2.masker (
NiftiMasker
or similar) – Masker object.~MKDAChi2.inputs_ (
dict
) – Inputs to the Estimator. For CBMA estimators, there is only one key: coordinates. This is an edited version of the dataset’s coordinates DataFrame.~MKDAChi2.null_distributions_ (
dict
ofnumpy.ndarray
) –Null distributions for any multiple-comparisons correction methods.
Important
MKDAChi2 does not retain uncorrected summary-statistic-to-p null distributions, since the summary statistic in this case is the chi-squared value, which has an established null distribution.
Entries are added to this attribute if and when the corresponding method is applied.
If
correct_fwe_montecarlo()
is applied:values_desc-pAgF_level-voxel_corr-fwe_method-montecarlo
: The maximum chi-squared value from the p(A|F) one-way chi-squared test from each Monte Carlo iteration. An array of shape (n_iters,).values_desc-pAgFsize_level-cluster_corr-fwe_method-montecarlo
: The maximum cluster size value from the p(A|F) one-way chi-squared test from each Monte Carlo iteration. An array of shape (n_iters,).values_desc-pAgFmass_level-cluster_corr-fwe_method-montecarlo
: The maximum cluster mass value from the p(A|F) one-way chi-squared test from each Monte Carlo iteration. An array of shape (n_iters,).values_desc-pFgA_level-voxel_corr-fwe_method-montecarlo
: The maximum chi-squared value from the p(F|A) two-way chi-squared test from each Monte Carlo iteration. An array of shape (n_iters,).values_desc-pFgAsize_level-cluster_corr-fwe_method-montecarlo
: The maximum cluster size value from the p(F|A) two-way chi-squared test from each Monte Carlo iteration. An array of shape (n_iters,).values_desc-pFgAmass_level-cluster_corr-fwe_method-montecarlo
: The maximum cluster mass value from the p(F|A) two-way chi-squared test from each Monte Carlo iteration. An array of shape (n_iters,).
Notes
The MKDA Chi-square algorithm was originally implemented as part of the Neurosynth Python library (https://github.com/neurosynth/neurosynth).
Available correction methods:
MKDAChi2.correct_fwe_montecarlo()
,MKDAChi2.correct_fdr_bh()
.References
Wager, Tor D., Martin Lindquist, and Lauren Kaplan. “Meta-analysis of functional neuroimaging data: current and future directions.” Social cognitive and affective neuroscience 2.2 (2007): 150-158. https://doi.org/10.1093/scan/nsm015
Methods
correct_fdr_bh
(result[, alpha])Perform FDR correction using the Benjamini-Hochberg method.
correct_fwe_montecarlo
(result[, ...])Perform FWE correction using the max-value permutation method.
fit
(dataset1, dataset2[, drop_invalid])Fit Estimator to two Datasets.
get_params
([deep])Get parameters for this estimator.
load
(filename[, compressed])Load a pickled class instance from file.
save
(filename[, compress])Pickle the class instance to the provided file.
set_params
(**params)Set the parameters of this estimator.
- correct_fdr_bh(result, alpha=0.05)[source]
Perform FDR correction using the Benjamini-Hochberg method.
Only call this method from within a Corrector.
- Parameters
result (
MetaResult
) – Result object from a KDA meta-analysis.alpha (
float
, optional) – Alpha. Default is 0.05.
- Returns
images – Dictionary of 1D arrays corresponding to masked images generated by the correction procedure. The following arrays are generated by this method: ‘z_desc-consistency_level-voxel’ and ‘z_desc-specificity_level-voxel’.
- Return type
See also
nimare.correct.FDRCorrector
The Corrector from which to call this method.
Examples
>>> meta = MKDAChi2() >>> result = meta.fit(dset) >>> corrector = FDRCorrector(method='bh', alpha=0.05) >>> cresult = corrector.transform(result)
- correct_fwe_montecarlo(result, voxel_thresh=0.001, n_iters=5000, n_cores=1)[source]
Perform FWE correction using the max-value permutation method.
Only call this method from within a Corrector.
Changed in version 0.0.12: Include cluster level-corrected results in Monte Carlo null method.
- Parameters
result (
MetaResult
) – Result object from a KDA meta-analysis.n_iters (
int
, optional) – Number of iterations to build the vFWE null distribution. Default is 5000.n_cores (
int
, optional) – Number of cores to use for parallelization. If <=0, defaults to using all available cores. Default is 1.
- Returns
images – Dictionary of 1D arrays corresponding to masked images generated by the correction procedure. The following arrays are generated by this method:
p_desc-consistency_level-voxel
: Voxel-level FWE-corrected p-values from the consistency/forward inference analysis.z_desc-consistency_level-voxel
: Voxel-level FWE-corrected z-values from the consistency/forward inference analysis.logp_desc-consistency_level-voxel
: Voxel-level FWE-corrected -log10 p-values from the consistency/forward inference analysis.p_desc-consistencyMass_level-cluster
: Cluster-level FWE-corrected p-values from the consistency/forward inference analysis, using cluster mass.z_desc-consistencyMass_level-cluster
: Cluster-level FWE-corrected z-values from the consistency/forward inference analysis, using cluster mass.logp_desc-consistencyMass_level-cluster
: Cluster-level FWE-corrected -log10 p-values from the consistency/forward inference analysis, using cluster mass.p_desc-consistencySize_level-cluster
: Cluster-level FWE-corrected p-values from the consistency/forward inference analysis, using cluster size.z_desc-consistencySize_level-cluster
: Cluster-level FWE-corrected z-values from the consistency/forward inference analysis, using cluster size.logp_desc-consistencySize_level-cluster
: Cluster-level FWE-corrected -log10 p-values from the consistency/forward inference analysis, using cluster size.p_desc-specificity_level-voxel
: Voxel-level FWE-corrected p-values from the specificity/reverse inference analysis.z_desc-specificity_level-voxel
: Voxel-level FWE-corrected z-values from the specificity/reverse inference analysis.logp_desc-specificity_level-voxel
: Voxel-level FWE-corrected -log10 p-values from the specificity/reverse inference analysis.p_desc-specificityMass_level-cluster
: Cluster-level FWE-corrected p-values from the specificity/reverse inference analysis, using cluster mass.z_desc-specificityMass_level-cluster
: Cluster-level FWE-corrected z-values from the specificity/reverse inference analysis, using cluster mass.logp_desc-specificityMass_level-cluster
: Cluster-level FWE-corrected -log10 p-values from the specificity/reverse inference analysis, using cluster mass.p_desc-specificitySize_level-cluster
: Cluster-level FWE-corrected p-values from the specificity/reverse inference analysis, using cluster size.z_desc-specificitySize_level-cluster
: Cluster-level FWE-corrected z-values from the specificity/reverse inference analysis, using cluster size.logp_desc-specificitySize_level-cluster
: Cluster-level FWE-corrected -log10 p-values from the specificity/reverse inference analysis, using cluster size.
- Return type
Notes
This method adds six new keys to the
null_distributions_
attribute:values_desc-pAgF_level-voxel_corr-fwe_method-montecarlo
: The maximum chi-squared value from the p(A|F) one-way chi-squared test from each Monte Carlo iteration. An array of shape (n_iters,).values_desc-pAgFsize_level-cluster_corr-fwe_method-montecarlo
: The maximum cluster size value from the p(A|F) one-way chi-squared test from each Monte Carlo iteration. An array of shape (n_iters,).values_desc-pAgFmass_level-cluster_corr-fwe_method-montecarlo
: The maximum cluster mass value from the p(A|F) one-way chi-squared test from each Monte Carlo iteration. An array of shape (n_iters,).values_desc-pFgA_level-voxel_corr-fwe_method-montecarlo
: The maximum chi-squared value from the p(F|A) two-way chi-squared test from each Monte Carlo iteration. An array of shape (n_iters,).values_desc-pFgAsize_level-cluster_corr-fwe_method-montecarlo
: The maximum cluster size value from the p(F|A) two-way chi-squared test from each Monte Carlo iteration. An array of shape (n_iters,).values_desc-pFgAmass_level-cluster_corr-fwe_method-montecarlo
: The maximum cluster mass value from the p(F|A) two-way chi-squared test from each Monte Carlo iteration. An array of shape (n_iters,).
See also
nimare.correct.FWECorrector
The Corrector from which to call this method.
Examples
>>> meta = MKDAChi2() >>> result = meta.fit(dset) >>> corrector = FWECorrector(method='montecarlo', n_iters=5, n_cores=1) >>> cresult = corrector.transform(result)
- fit(dataset1, dataset2, drop_invalid=True)[source]
Fit Estimator to two Datasets.
- Parameters
dataset1/dataset2 (
Dataset
) – Dataset objects to analyze.- Returns
Results of Estimator fitting.
- Return type
- classmethod load(filename, compressed=True)[source]
Load a pickled class instance from file.
- Parameters
- Returns
obj – Loaded class object.
- Return type
class object
- set_params(**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.- Return type
self