nimare.meta.ibma.Hedges
- class Hedges(weight_scheme='rescale', rho=0.8, small_sample_correction=None, **kwargs)[source]
Bases:
_PyMARERegressionEstimatorHedges meta-regression estimator.
Changed in version 0.21.0:
New parameters:
groupby,weight_schemeandrho.The
dofmap now reports Satterthwaite degrees of freedom for the CR2 standard errors. It is floating point rather thanint32, and varies by voxel.
Changed in version 0.2.1:
New parameter:
aggressive_mask, to control whether to use an aggressive mask.
Changed in version 0.0.12:
Add “se” to outputs.
Changed in version 0.0.8:
[FIX] Remove single-dimensional entries of each array of returns (
dict).
Added in version 0.0.4.
Estimates the between-subject variance tau^2 using the Hedges and Olkin[1] approach.
- Parameters:
aggressive_mask (
bool, optional) – Voxels with a value of zero of NaN in any of the input maps will be removed from the analysis. If False, all voxels are included by running a separate analysis on bags of voxels that belong that have a valid value across the same studies. Default is False.groupby (None,
str, array-like, or False, optional) – How to identify images that share participants and are therefore dependent. None (the default) groups bystudy_id. Astrnames a metadata field to group by instead, for a paper contributing independent samples (e.g. patients and controls). An array supplies one label per image. False treats every image as independent, which inflates significance whenever that is untrue. Default is None.weight_scheme ({'rescale', 'individual', 'collapse'}, optional) – How images within a group are weighted, passed to PyMARE.
'rescale'(the default) divides each image’s weight by its group size, so a group’s total weight does not grow with the number of maps it contributed – the correlated-effects model of Hedges et al.[2], weighted as in Fisher and Tipton[3].'individual'leaves the weights alone;'collapse'fits one row per group. Group labels also switch the standard errors to CR2 and the reference to a t distribution with Satterthwaite degrees of freedom [4].small_sample_correction (None or {'knapp-hartung', 'knapp-hartung-conservative', 'wald'}, optional) – How PyMARE corrects its model-based standard errors for a small number of studies, passed through unchanged. The Wald reference treats an estimated tau^2 as if it were known, which is anti-conservative with few studies; the Knapp-Hartung adjustment rescales the variance by the observed weighted residual spread and refers it to a t distribution [5]. Default is None, which leaves each PyMARE estimator on its own default – the adjustment where tau^2 is estimated, and
'wald'forWeightedLeastSquares, whose tau^2 is supplied rather than estimated. Ignored once group labels are present, where CR2 and Satterthwaite degrees of freedom are the correction instead.rho (
float, optional) – Assumed within-group correlation, in [0, 1]. Enters only through tau^2, to which results are weakly sensitive. Default is 0.8, matchingrobumeta. Ignored whenweight_scheme='individual'. Together the two choose a working model in the sense of Pustejovsky and Tipton[6]: cluster-robust standard errors stay valid if it is wrong, so the choice costs precision rather than validity.
Notes
Requires beta and varcope images.
fit()produces aMetaResultobject with the following maps:“z”
Z-statistic map from one-sample test.
“p”
P-value map from one-sample test.
“est”
Fixed effects estimate for intercept test.
“se”
Standard error of fixed effects estimate.
“tau2”
Estimated between-study variance.
“dof”
Degrees of freedom map from one-sample test.
Warning
Cluster-robust inference is asymptotic in the number of groups, not images. PyMARE warns at 10 or fewer groups, where robust variance estimation is anti-conservative [2], and when the Satterthwaite degrees of freedom fall below about 4 [4]. Both are common for small meta-analyses.
Masking approaches which average across voxels (e.g., NiftiLabelsMaskers) will likely result in biased results. The extent of this bias is currently unknown.
By default, image-based meta-analysis estimators run the analysis in bags of voxels, where each bag holds the voxels that have a valid value across the same studies. A voxel is therefore only dropped from the studies that are missing it. Setting
aggressive_mask=Trueinstead removes any voxel with a value of zero or NaN in any input map from the analysis entirely. Either way, a bag whose valid images all belong to one group is skipped – one group cannot support the inference – and its voxels come back as NaN.References
See also
pymare.estimators.HedgesThe PyMARE estimator called by this class.
Methods
fit(dataset[, drop_invalid])Fit Estimator to a collection.
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.
share_masked_image_cache(cache)Reuse already-masked input images across repeated fits of the same studyset.
- fit(dataset, drop_invalid=True)[source]
Fit Estimator to a collection.
- Parameters:
- Returns:
Result of Estimator fitting. Subclasses may return a
MetaResultsubclass.- Return type:
- Variables:
inputs (
dict) – Inputs used in _fit.warning:: (..) – Support for
Datasetinputs is deprecated and will be removed in NiMARE 1.0.0. PreferStudyset.and (The fit method is a light wrapper that runs input validation)
individual (preprocessing before fitting the actual model. Estimators')
should ("fitting" methods are implemented as _fit, although users)
fit. (call)
- 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
Reuse already-masked input images across repeated fits of the same studyset.
A leave-one-out diagnostic fits this estimator once per study, over subsets of one fixed set of images. Masking is per-image and does not depend on which other images are in the fit, so the default – reload, resample and mask every file on every fit – repeats the same work a number of times that grows with the square of the studyset.
- Parameters:
cache (
dictor None) – Mapping used to hold one masked row per image path. Callers that want the reuse to span several estimators (the copies a diagnostic refits) must hand the same dict to each of them; passing None turns the reuse off again. The caller owns the dict, and therefore its lifetime: entries live until it is dropped. It is only valid while the files it was filled from are unchanged.
Notes
The cached row is never handed out, only copied into each fit’s own array, so a caller that edits
inputs_cannot corrupt a later fit.