dat2mat {SPARRAfairness} | R Documentation |
dat2mat
Description
Generates matrices for decomposition of admission type which can be used in plot_decomp
Usage
dat2mat(dat, score, group1, group2, nquant = 20, cats = unique(dat$reason))
Arguments
dat |
data frame with population data, such as output from sim_pop_data. Must include a column |
score |
risk scores corresponding to |
group1 |
indices for group 1 |
group2 |
indices for group 2 |
nquant |
number of quantiles of code to use; default 20 |
cats |
vector of strings giving names of admission categories; default the unique values in dat$reason. Can include NAs. |
Details
Generates two matrices with the following specifications: Each matrix corresponds to one group 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 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
Value
list with two objects matrix1
and matrix2
giving output matrices
Examples
# See vignette