di_iterate {DisImpact}  R Documentation 
Iteratively calculate disproportionate impact using multiple method for many variables.
Description
Iteratively calculate disproportionate impact via the percentage point gap (PPG), proportionality index, and 80% index methods for many success variables, disaggregation variables, and scenarios.
Usage
di_iterate(
data,
success_vars,
group_vars,
cohort_vars = NULL,
scenario_repeat_by_vars = NULL,
exclude_scenario_df = NULL,
weight_var = NULL,
include_non_disagg_results = TRUE,
ppg_reference_groups = "overall",
min_moe = 0.03,
use_prop_in_moe = FALSE,
prop_sub_0 = 0.5,
prop_sub_1 = 0.5,
di_prop_index_cutoff = 0.8,
di_80_index_cutoff = 0.8,
di_80_index_reference_groups = "hpg",
check_valid_reference = TRUE,
parallel = FALSE,
parallel_n_cores = parallel::detectCores(),
parallel_split_to_disk = FALSE
)
Arguments
data 
A data frame for which to iterate DI calculations for a set of variables. 
success_vars 
A character vector of success variable names to iterate across. 
group_vars 
A character vector of group (disaggregation) variable names to iterate across. 
cohort_vars 
(Optional) A character vector of the same length as 
scenario_repeat_by_vars 
(Optional) A character vector of variables to repeat DI calculations for across all combination of these variables. For example, the following variables could be specified:
Each combination of these variables (eg, full time, first time college students with an ed goal of degree/transfer as one combination) would constitute an iteration / sample for which to calculate disproportionate impact for outcomes listed in 
exclude_scenario_df 
(Optional) A data frame with variables that match 
weight_var 
(Optional) A character variable specifying the weight variable if the input data set is summarized (i.e., the the success variables specified in 
include_non_disagg_results 
A logical variable specifying whether or not the nondisaggregated results should be returned; defaults to 
ppg_reference_groups 
Either 
min_moe 
The minimum margin of error to be used in the PPG calculation, passed to di_ppg. 
use_prop_in_moe 
Whether the estimated proportions should be used in the margin of error calculation by the PPG, passed to di_ppg. 
prop_sub_0 
passed to di_ppg; defaults to 0.50. 
prop_sub_1 
passed to di_ppg; defaults to 0.50. 
di_prop_index_cutoff 
Threshold used for determining disproportionate impact using the proportionality index; passed to di_prop_index; defaults to 0.80. 
di_80_index_cutoff 
Threshold used for determining disproportionate impact using the 80% index; passed to di_80_index; defaults to 0.80. 
di_80_index_reference_groups 
Either 
check_valid_reference 
Check whether 
parallel 
If 
parallel_n_cores 
The number of CPU cores to use if 
parallel_split_to_disk 
If 
Details
Iteratively calculate disproportionate impact via the percentage point gap (PPG), proportionality index, and 80% index methods for all combinations of success_vars
, group_vars
, and cohort_vars
, for each combination of subgroups specified by scenario_repeat_by_vars
.
Value
A summarized data set (data frame) consisting of:

success_variable
(elements ofsuccess_vars
), 
disaggregation
(elements ofgroup_vars
), 
cohort
(values corresponding to the variables specified incohort_vars
, 
di_indicator_ppg
(1 if there is disproportionate impact per the percentage point gap method, 0 otherwise), 
di_indicator_prop_index
(1 if there is disproportionate impact per the proportionality index, 0 otherwise), 
di_indicator_80_index
(1 if there is disproportionate impact per the 80% index, 0 otherwise), and other relevant fields returned from di_ppg, di_prop_index, and di_80_index.
Examples
library(dplyr)
data(student_equity)
# Multiple group variables
di_iterate(data=student_equity, success_vars=c('Transfer')
, group_vars=c('Ethnicity', 'Gender'), cohort_vars=c('Cohort')
, ppg_reference_groups='overall')