View source: R/percentage_point_gap.R
| di_ppg | R Documentation |
Calculate disproportionate impact per the percentage point gap (PPG) method.
di_ppg(
success,
group,
cohort,
weight,
reference = c("overall", "hpg", "all but current", unique(group)),
data,
min_moe = 0.03,
use_prop_in_moe = FALSE,
prop_sub_0 = 0.5,
prop_sub_1 = 0.5,
check_valid_reference = TRUE
)
success |
A vector of success indicators ( |
group |
A vector of group names of the same length as |
cohort |
(Optional) A vector of cohort names of the same length as |
weight |
(Optional) A vector of case weights of the same length as |
reference |
Either
|
data |
(Optional) A data frame containing the variables of interest. If |
min_moe |
The minimum margin of error (MOE) to be used in the calculation of disproportionate impact and is passed to ppg_moe. Defaults to |
use_prop_in_moe |
A logical value indicating whether or not the MOE formula should use the observed success rates ( |
prop_sub_0 |
For cases where |
prop_sub_1 |
For cases where |
check_valid_reference |
Check whether |
This function determines disproportionate impact based on the percentage point gap (PPG) method, as described in this reference from the California Community Colleges Chancellor's Office. It assumes that a higher rate is good ("success"). For rates that are deemed negative (eg, rate of drop-outs, high is bad), then consider looking at the converse of the non-success (eg, non drop-outs, high is good) instead in order to leverage this function properly. Note that the margin of error (MOE) is calculated using using 1.96*sqrt(0.25^2/n), with a min_moe used as the minimum by default.
A data frame consisting of:
cohort (if used),
group,
n (sample size),
success (number of successes for the cohort-group),
pct (proportion of successes for the cohort-group),
reference_group (reference group used in DI calculation),
reference (reference value used in DI calculation),
moe (margin of error),
pct_lo (lower 95% confidence limit for pct),
pct_hi (upper 95% confidence limit for pct),
di_indicator (1 if there is disproportionate impact, ie, when pct_hi <= reference),
success_needed_not_di (the number of additional successes needed in order to no longer be considered disproportionately impacted as compared to the reference), and
success_needed_full_parity (the number of additional successes needed in order to achieve full parity with the reference).
California Community Colleges Chancellor's Office (2017). Percentage Point Gap Method.
library(dplyr) data(student_equity) # Vector di_ppg(success=student_equity$Transfer , group=student_equity$Ethnicity) %>% as.data.frame # Tidy and column reference di_ppg(success=Transfer, group=Ethnicity, data=student_equity) %>% as.data.frame # Cohort di_ppg(success=Transfer, group=Ethnicity, cohort=Cohort , data=student_equity) %>% as.data.frame # With custom reference (single) di_ppg(success=Transfer, group=Ethnicity, reference=0.54 , data=student_equity) %>% as.data.frame # With custom reference (multiple) di_ppg(success=Transfer, group=Ethnicity, cohort=Cohort , reference=c(0.5, 0.55), data=student_equity) %>% as.data.frame # min_moe di_ppg(success=Transfer, group=Ethnicity, data=student_equity , min_moe=0.02) %>% as.data.frame # use_prop_in_moe di_ppg(success=Transfer, group=Ethnicity, data=student_equity , min_moe=0.02 , use_prop_in_moe=TRUE) %>% as.data.frame
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.