Skip to main content
. 2024 Apr 24;7(3):36. doi: 10.3390/mps7030036
Algorithm 1. Algorithm (simplified for visualization) of the advanced equalization function.
Input: Dataset, TargetVariable, VariableList, MinThreshold
Output: EqualizedDataset
Begin
   Initialize equalized dataset as empty
   Calculate initial subpopulation sizes and proportions for TargetVariable
   Set target size to the size of the smallest subpopulation

   For each variable in VariableList do
    Determine the impact score based on deviation from expected proportions
   End For

   Sort VariableList by descending impact scores

   While subpopulation sizes differ from target size do
    For each variable in VariableList do
      Adjust subpopulation proportion to match target proportion
      If subpopulation size < MinThreshold then
       Protect subpopulation from further reduction
      End If
    End For
    Recalculate subpopulation sizes and proportions
   End While

   Output the equalized dataset
End