Generate SQL code that calculates disproportionate impact via the percentage point gap (PPG), proportionality index, and 80% index methods for a specified table name, success variable, group variable, and cohort variable. This is the workhorse function leveraged by the di_iterate_sql function.
di_calc_sql(
db_table_name,
success_var,
group_var,
cohort_var = "",
weight_var = 1,
ppg_reference_group = "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_group = "hpg",
before_with_statement = "",
after_with_statement = "",
end_of_select_statement = "",
where_statement = "",
select_statement_add = ""
)
A character value (SQL query) that could be executed on a database.
A character value specifying a database table name.
A character value specifying the success variable name.
A character value specifying the group (disaggregation) variable name.
(Optional) A character value specifying the cohort variable. If not specified, then a single cohort is assumed (defaults to an empty string, ''
).
(Optional) A character variable specifying the weight variable if the input data set is summarized (i.e., the the success variables specified in success_vars
contain count of successes). Weight here corresponds to the denominator when calculating the success rate. Defaults to a numeric 1
which treats each row as an individual.
Either 'overall'
, 'hpg'
, 'all but current'
, or a character value specifying a group from group_var
to be used as the reference group for comparison using the percentage point gap method.
The minimum margin of error to be used in the PPG calculation; see di_ppg.
(TRUE
or FALSE
) Whether the estimated proportions should be used in the margin of error calculation by the PPG; see di_ppg.
Default is 0.50; see di_ppg.
Default is 0.50; see di_ppg.
Threshold used for determining disproportionate impact using the proportionality index; see di_prop_index; defaults to 0.80.
Threshold used for determining disproportionate impact using the 80% index; see di_80_index; defaults to 0.80.
Either 'overall'
, 'hpg'
, 'all but current'
, or a character value specifying a group from group_var
to be used as the reference group for comparison using 80% index.
Character value to be added to the SQL query to allow for modification. Defaults to ''
(empty string).
Character value to be added to the SQL query to allow for modification. Defaults to ''
(empty string).
Character value to be added to the SQL query to allow for modification. Defaults to ''
(empty string).
Character value to be added to the SQL query to allow for modification. Defaults to ''
(empty string).
Character value to be added to the SQL query to allow for modification. Defaults to ''
(empty string).