Make LOS and Readmit Index Summary Tibble
Source:R/data_tbl_functions.R
los_ra_index_summary_tbl.Rd
Create the length of stay and readmit index summary tibble
Usage
los_ra_index_summary_tbl(
.data,
.max_los = 15,
.alos_col,
.elos_col,
.readmit_rate,
.readmit_bench
)
Arguments
- .data
The data you are going to analyze.
- .max_los
You can give a maximum LOS value. Lets say you typically do not see los over 15 days, you would then set .max_los to 15 and all values greater than .max_los will be grouped to .max_los
- .alos_col
The Average Length of Stay column
- .elos_col
The Expected Length of Stay column
- .readmit_rate
The Actual Readmit Rate column
- .readmit_bench
The Expected Readmit Rate column
Details
Expects a tibble
Expects the following columns and there should only be these 4
Length Of Stay Actual - Should be an integer
Length Of Stacy Benchmark - Should be an integer
Readmit Rate Actual - Should be 0/1 for each record, 1 = readmitted, 0 did not.
Readmit Rate Benchmark - Should be a percentage from the benchmark file.
This will add a column called visits that will be the count of records per length of stay from 1 to .max_los
The .max_los param can be left blank and the function will default to 15. If this is not a good default and you don't know what it should be then set it to 75 percentile from the
stats::quantile()
function using the defaults, like so .max_los =stats::quantile(data_tbl$alos)[[4]]
Uses all data to compute variance, if you want it for a particular time frame you will have to filter the data that goes into the .data argument. It is suggested to use
timetk::filter_by_time()
The index is computed as the excess of the length of stay or readmit rates over their respective expectations.
Examples
suppressPackageStartupMessages(library(dplyr))
data_tbl <- tibble(
"alos" = runif(186, 1, 20)
, "elos" = runif(186, 1, 17)
, "readmit_rate" = runif(186, 0, .25)
, "readmit_bench" = runif(186, 0, .2)
)
los_ra_index_summary_tbl(
.data = data_tbl
, .max_los = 15
, .alos_col = alos
, .elos_col = elos
, .readmit_rate = readmit_rate
, .readmit_bench = readmit_bench
)
#> # A tibble: 15 × 4
#> los_group los_index rar_index los_ra_var
#> <dbl> <dbl> <dbl> <dbl>
#> 1 1 0.134 1.56 1.42
#> 2 2 0.201 2.43 2.23
#> 3 3 0.310 1.3 0.990
#> 4 4 0.409 1.62 1.22
#> 5 5 0.546 1.08 0.538
#> 6 6 0.567 0.929 0.504
#> 7 7 0.793 1.08 0.290
#> 8 8 0.840 1.38 0.535
#> 9 9 0.780 1.22 0.442
#> 10 10 1.15 1.3 0.452
#> 11 11 1.16 1.3 0.455
#> 12 12 1.65 2.33 1.98
#> 13 13 1.55 1.33 0.881
#> 14 14 1.56 1.36 0.923
#> 15 15 2.16 1.27 1.43
los_ra_index_summary_tbl(
.data = data_tbl
, .max_los = 10
, .alos_col = alos
, .elos_col = elos
, .readmit_rate = readmit_rate
, .readmit_bench = readmit_bench
)
#> # A tibble: 10 × 4
#> los_group los_index rar_index los_ra_var
#> <dbl> <dbl> <dbl> <dbl>
#> 1 1 0.134 1.56 1.42
#> 2 2 0.201 2.43 2.23
#> 3 3 0.310 1.3 0.990
#> 4 4 0.409 1.62 1.22
#> 5 5 0.546 1.08 0.538
#> 6 6 0.567 0.929 0.504
#> 7 7 0.793 1.08 0.290
#> 8 8 0.840 1.38 0.535
#> 9 9 0.780 1.22 0.442
#> 10 10 1.72 1.4 1.12