Learn R Programming

SPARRAfairness (version 0.1.0.0)

for_breakdown: for_breakdown

Description

For a given category (e.g., 'male', 'over 65') considers

  1. all admissions for people in that category

  2. all admissions for people in that category for which the SPARRA score was less than some threshold (e.g., false negatives

Usage

for_breakdown(
  decomp_table,
  group,
  threshold,
  inc_died = TRUE,
  ldiff = 0.005,
  ci = 0.95,
  xlimit = c(-0.05, 0.35),
  ylimit = c(-0.04, 0.04)
)

Value

ggplot figure (invisible)

Arguments

decomp_table

matrix for group; see specification in description

group

name of group

threshold

cutoff, rounded to nearest 0.05

inc_died

set to TRUE to include a second panel showing 'death' type admissions

ldiff

specifically label points this far from xy line

ci

set to a value <1 to draw confidence intervals at that value, or FALSE to not draw confidence intervals.

xlimit

limits for x axis; default c(-0.05,0.35)

ylimit

limits for y axis; default c(-0.04,0.04)

Details

For each of these groups, we consider the breakdown of medical admission types. We then plot the frequency of admission types in group 1 against the difference in frequencies between group 1 and group 2 (group 2 minus group 1). An admission type which is relatively more common in group (1) indicates that, in the relevant category, the admission type tends to be associated with higher SPARRA scores (and is in a sense easier to predict). Such admission types will correspond to points below the line y=0. Admission types which are relatively more common in group 2 correspond to those which are relatively harder to predict. These correspond to points above the line y=0 Since points are close together, only those greater than a certain distance from 0 are marked.

Takes as an argument a matrix in which The matrix shows only data for the group in question Columns are named with the admission types to be plotted. Any admission types including the string 'Died' are counted as deaths If the matrix has N rows, these are interpreted as corresponding to N score quantiles in increasing order. The (i,j)th entry of the matrix is the number of people admitted for reason i with a score greater than or equal to (j-1)/N and less than (j/N) who are in that group

Examples

Run this code

# See vignette

Run the code above in your browser using DataLab