View source: R/SPARRAfairness_simulation.R
dat2mat | R Documentation |
Generates matrices for decomposition of admission type which can be used in plot_decomp
dat2mat(dat, score, group1, group2, nquant = 20, cats = unique(dat$reason))
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. |
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
list with two objects matrix1
and matrix2
giving output matrices
# See vignette
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.