NiMARE
NiMARE copied to clipboard
Add weighting options to MKDADensity
Currently the MKDADensity estimator automatically weights by sample size and inference type (fixed vs. random effects). It makes sense to keep these as the defaults for consistency with the Matlab implementation, but we should probably add the ability to disable these weightings, and also to pass custom weights.
We could, e.g., add a weights initialization argument that's set to 'auto' by default (current behavior), but alternatively can be set to 'sample_size', 'inference_type', or provide the name of a metadata column in the dataset, in which case the values found there are used as weights.
If we want to allow arbitrary weights based on fields in the metadata or coordinates attributes, should we also allow users to specify any transformations they want on those weights before they're used in the meta-analysis? E.g., when you say sample_size, maybe you might really want to use the square root of the sample size (as we automatically do for the weighted Stouffer's IBMA Estimator).
I see two ways to do this:
- Add some kind of function in
nimare.transformsthat will operate on, and add to, the DataFrame attributes. So beforehand you could say that you wantsample_size_sqrtto be the square root of the mean of thesample_sizescolumn of themetadataattribute. - Incorporate transformations into the initialization parameter. So weights, I guess, would probably be a dictionary.