fairlens.metrics.brunner_munzel_test#
- brunner_munzel_test(df, target_attr, group1, group2)[source]#
Compute the non-parametric Brunner-Munzel test of the hypothesis that the probability of getting large values in the target attribute distributions (determined by the input groups of interest) is equal, without requiring equivariance.
- Parameters
df (pd.DataFrame) – The input datafame.
target_attr (str) – The target attribute in the dataframe from which the distributions are formed.
group1 (Union[Mapping[str, List[Any]], pd.Series]) – The first group of interest. Each group can be a mapping / dict from attribute to value or a predicate itself, i.e. pandas series consisting of bools which can be used as a predicate to index a subgroup from the dataframe. Examples: {“Sex”: [“Male”]}, df[“Sex”] == “Female”
group2 (Union[Mapping[str, List[Any]], pd.Series]) – The second group of interest. Each group can be a mapping / dict from attribute to value or a predicate itself, i.e. pandas series consisting of bools which can be used as a predicate to index a subgroup from the dataframe. Examples: {“Sex”: [“Male”]}, df[“Sex”] == “Female”
- Returns
A tuple consisting of the Brunner-Munzel statistic and p-value associated with the significance of the observed difference.
- Return type
Tuple[float, float]