odds_ratio
odds_ratio#
- solas_disparity.odds_ratio(...)#
Calculate the Odds Ratio for a given set of protected and reference groups.
The odds of a favorable outcome is the probability of a favorable outcome divided by its complement.
\[\text{Favorable Outcome Odds} = \frac{P(\text{Favorable Outcome})}{P(\text{Favorable Outcome})^\complement}\]The Odds Ratio is defined as the odds of a favorable outcome of the protected group divided by that of the reference group.
\[\text{Odds Ratio}_\text{Protected Group} = \frac{\text{Favorable Outcome Odds}_\text{Protected Group}}{\text{Favorable Outcome Odds}_\text{Reference Group}}\]- An Odds Ratio is considered practically significant if
lower_score_favorable=False
and the Odds Ratio is: lesser than a chosen
odds_ratio_threshold
,statistically significantly different than parity,
AND greater than a chosen
percent_difference_threshold
.
- Alternatively, an Odds Ratio is considered practically significant if
lower_score_favorable=True
and the Odds Ratio is: greater than a chosen
odds_ratio_threshold
,statistically significantly different than parity,
AND greater than a chosen
percent_difference_threshold
.
- 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) – Boolean outcome series.
odds_ratio_threshold (float) – Odds Ratio threshold value.
percent_difference_threshold (float) – Percent difference threshold value. For example, a 20% difference is input as
percent_difference_threshold=0.2
.lower_score_favorable (bool, optional) – Whether a lower value of
outcome
(i.e.0
) is favorable. Defaults to False.label (Optional[Series], optional) – Boolean label, true outcome, and/or target series evaluated alongside
outcome
. Defaults to None.sample_weight (Optional[Series], optional) – Sample weight series. Has the same length as
group_data
. Defaults to None.max_for_fishers (int, optional) – Maximum value of samples for Fisher’s exact test to be used. Defaults to MAX_FOR_FISHERS.
- Returns
Object containing results of the disparity calculation.
- Return type
- An Odds Ratio is considered practically significant if