fishers_or_chi_squared#

solas_disparity.statistical_significance.fishers_or_chi_squared(...)#

Conduct either a Fisher’s exact test or a chi-squared test. If max_for_fishers is greater than any value of the expected or observed contingency table, the Fisher’s exact test is conducted. Else, the chi-squared test is conducted.

Parameters
  • group_data (DataFrame) – Dataframe containing columns for group data.

  • protected_groups (List[str]) – List of protected groups.

  • reference_groups (List[str]) – List of reference groups with the same length as protected_groups.

  • group_categories (List[str]) – List of group categories to which each protected and reference group pair belongs to (e.g. race, gender, age, etc.). Has the same length as protected_groups.

  • outcome (Series) – Outcome series.

  • sample_weight (Optional[pd.Series], optional) – Sample weight series. Has the same length as group_data. Defaults to None.

  • max_for_fishers (Union[int, float], optional) – Maximum value of samples for Fisher’s exact test to be used. Defaults to const.MAX_FOR_FISHERS.

Returns

Statistical significance result object.

Return type

StatSig