View source: R/di_iterate_on_long.R
| di_iterate_on_long | R Documentation |
Calculate disproportionate impact via the percentage point gap (PPG), proportionality index, and 80% index methods for a "long" and summarized data set with many success variables and disaggregation variables, where the success counts and disaggregation groups are stored in a single column or variable for each.
di_iterate_on_long( data, num_var, denom_var, disagg_var_col, group_var_col, disagg_var_col_2 = NULL, group_var_col_2 = NULL, cohort_var_col = NULL, summarize_by_vars = NULL, custom_reference_group_flag_var = NULL, ... )
data |
A data frame for which to iterate DI calculations for a set of variables. |
num_var |
A variable name (character value) from |
denom_var |
A variable name (character value) from |
disagg_var_col |
A variable name (character value) from |
group_var_col |
A variable name (character value) from |
disagg_var_col_2 |
(Optional) A variable name (character value) from |
group_var_col_2 |
(Optional) A variable name (character value) from |
cohort_var_col |
(Optional) A variable name (character value) from |
summarize_by_vars |
(Optional) A character vector of variable names in |
custom_reference_group_flag_var |
(Optional) A variable name (character value) from |
... |
(Optional) Other arguments such as |
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.
A summarized data set (data frame) consisting of:
variables specified by summarize_by_vars, disagg_var_col, group_var_col, disagg_var_col_2, and group_var_col_2,
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.
library(dplyr)
data(ssm_cohort)
di_iterate_on_long(data=ssm_cohort %>% filter(missingFlag==0) # remove missing data
, num_var='value', denom_var='denom'
, disagg_var_col='disagg1', group_var_col='subgroup1'
, cohort_var_col='academicYear', summarize_by_vars=c('categoryLabel')
, ppg_reference_groups='all but current' # PPG-1
, di_80_index_reference_groups='all but current')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.