Skip to contents

This function lets you easily compute differences in conditional expectations between all pairs of specified racial groups.

Usage

disparities(x, subgroup = FALSE, races = TRUE)

Arguments

x

A birdie model object.

subgroup

If TRUE, return subgroup-level (rather than marginal) disparity estimates.

races

A character vector of racial groups to compute disparities for. The special value TRUE, the default, computes disparities for all racial groups.

Value

A data frame containing a row with every possible disparity for the specified races, which are identified by columns race_1 and race_2. The reported disparity is estimate_1 - estimate_2.

Examples

data(pseudo_vf)
r_probs = bisg(~ nm(last_name) + zip(zip), data=pseudo_vf)
fit = birdie(r_probs, turnout ~ 1, data=pseudo_vf)

disparities(fit)
#> # A tibble: 60 × 6
#>    race_1 race_2 turnout estimate_1 estimate_2 disparity
#>    <chr>  <chr>  <chr>        <dbl>      <dbl>     <dbl>
#>  1 black  white  no           0.358      0.301    0.0573
#>  2 black  white  yes          0.642      0.699   -0.0573
#>  3 hisp   white  no           0.392      0.301    0.0908
#>  4 hisp   white  yes          0.608      0.699   -0.0908
#>  5 asian  white  no           0.613      0.301    0.312 
#>  6 asian  white  yes          0.387      0.699   -0.312 
#>  7 aian   white  no           0.778      0.301    0.477 
#>  8 aian   white  yes          0.222      0.699   -0.477 
#>  9 other  white  no           0.254      0.301   -0.0468
#> 10 other  white  yes          0.746      0.699    0.0468
#> # ℹ 50 more rows
disparities(fit, races=c("white", "black"))
#> # A tibble: 4 × 6
#>   race_1 race_2 turnout estimate_1 estimate_2 disparity
#>   <chr>  <chr>  <chr>        <dbl>      <dbl>     <dbl>
#> 1 black  white  no           0.358      0.301    0.0573
#> 2 black  white  yes          0.642      0.699   -0.0573
#> 3 white  black  no           0.301      0.358   -0.0573
#> 4 white  black  yes          0.699      0.642    0.0573