nimare.meta.cbmr.CBMRInference
- class CBMRInference(device='cpu')[source]
Bases:
objectStatistical inference on fitted CBMR results.
Notes
The CBMR API design now centers inference on
CBMRResult. This class remains the lower-level implementation used by those result helpers and by advanced users who want to callfit()andtransform()directly.Added in version 0.1.0.
- Parameters:
device (
string, optional) – Device type (‘cpu’ or ‘cuda’) represents the device on which operations will be allocated. Default is ‘cpu’.
Methods
create_contrast(contrast_name[, source])Create contrast matrix for generalized hypothesis testing (GLH).
Create regular expressions for parsing contrast names.
display()Display Groups and Moderator names and order.
fit(result)Fit CBMRInference instance.
fit_transform(result[, t_con_groups, ...])Fit and transform.
transform([t_con_groups, t_con_moderators])Conduct generalized linear hypothesis (GLH) testing on CBMR estimates.
- create_contrast(contrast_name, source='groups')[source]
Create contrast matrix for generalized hypothesis testing (GLH).
Named group contrasts may refer to a single group (for a homogeneity test) or a pairwise comparison such as
group_a-group_b. Named moderator contrasts follow the same pattern.
- create_regular_expressions()[source]
Create regular expressions for parsing contrast names.
creates the following attributes: self.groups_regular_expression: regular expression for parsing group names self.moderators_regular_expression: regular expression for parsing moderator names
usage: >>> self.groups_regular_expression.match(“group1 - group2”).groupdict()
- fit(result)[source]
Fit CBMRInference instance.
- Parameters:
result (
CBMRResult) – Fitted CBMR result containing regression coefficient tables and spatial intensity maps.
- transform(t_con_groups=None, t_con_moderators=None)[source]
Conduct generalized linear hypothesis (GLH) testing on CBMR estimates.
Estimate group-wise spatial regression coefficients and its standard error via inverse Fisher Information matrix, estimate standard error of group-wise log intensity, group-wise intensity via delta method. For NB or clustered model, estimate regression coefficient of overdispersion. Similarly, estimate regression coefficient of experiment-level moderators (if exist), as well as its standard error via Fisher Information matrix. Save these outcomes in tables. Also, estimate group-wise spatial intensity (per experiment) and save the results in maps.
- Parameters:
t_con_groups (bool, dict, list, tuple, str, or None, optional) – Group inference specification. Use
NoneorTrueto test all groups,Falseto skip group inference, named contrasts such as"group_a-group_b"or("group_a", "group_b")for pairwise tests, a dict mapping names to contrast arrays, or raw contrast arrays.t_con_moderators (bool, dict, list, tuple, str, or None, optional) – Moderator inference specification with the same accepted forms as
t_con_groups.