All Projects → johnmackintosh → runcharter

johnmackintosh / runcharter

Licence: GPL-3.0 License
Automating run chart analysis for faceted displays of data across multiple metrics or locations

Programming Languages

r
7636 projects

Projects that are alternatives of or similar to runcharter

cusumcharter
Easier CUSUM control charts. Returns simple CUSUM statistics, CUSUMs with control limit calculations, and function to generate faceted CUSUM Control Charts
Stars: ✭ 17 (-45.16%)
Mutual labels:  healthcare, rstats, quality-improvement, rdatatable
patientcounter
fast, flexible patient census tables. Quickly count patients or resources by interval. No SQL, no problem.
Stars: ✭ 19 (-38.71%)
Mutual labels:  nhs, rstats-package, rdatatable
NHSRtheme
R package that helps to create plots that follow the NHS Identity
Stars: ✭ 19 (-38.71%)
Mutual labels:  rstats, nhs, nhs-r-community
open-health-statistics
Statistics on open source healthcare repositories
Stars: ✭ 20 (-35.48%)
Mutual labels:  healthcare, nhs
NHSRdatasets
NHS and healthcare related datasets for training and learning R
Stars: ✭ 54 (+74.19%)
Mutual labels:  nhs, nhs-r-community
pbapply
Adding progress bar to '*apply' functions in R
Stars: ✭ 115 (+270.97%)
Mutual labels:  rstats, rstats-package
openeobs
An e-observations and ward management tool for Acute and Mental Health hospitals.
Stars: ✭ 24 (-22.58%)
Mutual labels:  healthcare, nhs
teach-r-online
Materials for the Teaching statistics and data science online workshops in July 2020
Stars: ✭ 52 (+67.74%)
Mutual labels:  rstats
diabetes use case
Sample use case for Xavier AI in Healthcare conference: https://www.xavierhealth.org/ai-summit-day2/
Stars: ✭ 22 (-29.03%)
Mutual labels:  healthcare
climateR
An R 📦 for getting point and gridded climate data by AOI
Stars: ✭ 93 (+200%)
Mutual labels:  rstats
QuickLookR
macOS QuickLook plugin for R save(), saveRDS() & feather files
Stars: ✭ 41 (+32.26%)
Mutual labels:  rstats
schtools
Schloss Lab Tools for Reproducible Microbiome Research 💩
Stars: ✭ 22 (-29.03%)
Mutual labels:  rstats
waypointer
Waypoints & Animations for Shiny
Stars: ✭ 16 (-48.39%)
Mutual labels:  rstats
rems
An R package to access data from British Columbia's Environmental Monitoring System
Stars: ✭ 18 (-41.94%)
Mutual labels:  rstats
getCRUCLdata
CRU CL v. 2.0 Climatology Client for R
Stars: ✭ 17 (-45.16%)
Mutual labels:  rstats
tdigest
Wicked Fast, Accurate Quantiles Using 't-Digests'
Stars: ✭ 32 (+3.23%)
Mutual labels:  rstats
dotwhisker
Dot-and-Whisker Plots of Regression Results
Stars: ✭ 51 (+64.52%)
Mutual labels:  rstats
bc-population-indicator
R scripts for an indicator on trends in B.C.'s population size & distribution published on Environmental Reporting BC
Stars: ✭ 12 (-61.29%)
Mutual labels:  rstats
twinetverse
💫 Easily install and load packages for Twitter network analysis and visualisation
Stars: ✭ 19 (-38.71%)
Mutual labels:  rstats
rsnps
Wrapper to a number of SNP web APIs
Stars: ✭ 44 (+41.94%)
Mutual labels:  rstats

runcharter

Automated analysis and re-basing of run charts at scale.

Online documentation and vignettes : https://johnmackintosh.github.io/runcharter/

R-CMD-check

Project Status: Active – The project has reached a stable, usable state and is being actively developed. Coverage status Render README Codecov test coverage CRAN status

Installation

You can install the latest stable version from CRAN with:

install.packages("runcharter")

You can install the development version from github with:

# install.packages("remotes") # if not already installed
remotes::install_github("johnmackintosh/runcharter")

# to ensure the vignettes are built or ensure latest version is installed:

remotes::install_github("johnmackintosh/runcharter", 
                         build_vignettes = TRUE)

The rationale for the package is to analyse multiple run charts at once. More importantly, the package will identify a run of n successive points on the desired side of the median line, and will recalculate / rebase the median accordingly. Each time a run occurs, the median will be rebased. This helps to track improvements over time.

The default is to plot a faceted plot, allowing ggplot2 to handle the axis limits. You can specify the number of columns in the faceted plot however, and you can also specify both the breaks for date labels on the x axis, and whether the y axis limits are fixed, or can vary by facet panel.

Function arguments and defaults

A default run of 9 is specified as that is the length of run used by the IHI for its patient safety initiatives worldwide.

library(runcharter)
runcharter(df = signals,
          med_rows = 13,
          runlength = 9,
          direction = "below",
          datecol = NULL,
          grpvar = NULL,
          yval = NULL,
          facet_cols = NULL,
          facet_scales = "fixed",
          chart_title = NULL,
          chart_subtitle = NULL,
          chart_caption = NULL,
          chart_breaks = NULL,
          line_colr = "#005EB8", # blue
          point_colr ="#005EB8", # blue
          median_colr = "#E87722", # orange
          highlight_fill = "#DB1884") # magenta

The function will return a plot and a summary table showing the original baseline medians, and any sustained runs of improvement beyond the baseline period.

library(runcharter)

runcharter(signals,
           direction = "below",
           datecol = date, 
           grpvar = grp,
           yval = y, 
          chart_title = "Runs identified",
          chart_subtitle = "Runs below the median signalling improvement")
#> $runchart

#> 
#> $sustained
#>      grp median start_date   end_date  extend_to  run_type
#> 1: WardV      7 2014-01-01 2015-01-01 2018-07-01  baseline
#> 2: WardX     11 2014-01-01 2015-01-01 2016-12-01  baseline
#> 3: WardY     13 2014-01-01 2015-01-01 2017-10-01  baseline
#> 4: WardZ      4 2014-01-01 2015-01-01 2018-07-01  baseline
#> 5: WardX      6 2016-12-01 2017-08-01 2018-07-01 sustained
#> 6: WardY      8 2017-10-01 2018-06-01 2018-07-01 sustained

Runs in both directions

The package allows for finding runs in both directions (above and below the median). Generally, for improvement purposes, you would only need to identify runs in one direction at a time. In other words, if you are trying to reduce adverse events, improvement will be evidenced with a run below the median. Therefore, you would not rebase the median if a run of points above the median was observed.

However, for longer term monitoring, it may be necessary to identify and ‘reset’ a median if a sustained deterioration in performance occurs. Ideally, you should move to using SPC charts for monitoring purposes.

library(runcharter)
signals %>% 
  runcharter(med_rows = 7, 
             runlength = 5,
             direction = "both",
             datecol = date, 
              grpvar = grp,
              yval = y, 
             chart_title = "Runs in both directions",
             chart_subtitle = "Runs of 5, from median calculated over first 7 data points in each location")
#> $runchart

#> 
#> $sustained
#>       grp median start_date   end_date  extend_to  run_type
#>  1: WardV      5 2014-01-01 2014-07-01 2015-01-01  baseline
#>  2: WardX     11 2014-01-01 2014-07-01 2014-11-01  baseline
#>  3: WardY     14 2014-01-01 2014-07-01 2014-12-01  baseline
#>  4: WardZ      4 2014-01-01 2014-07-01 2015-01-01  baseline
#>  5: WardV     15 2015-01-01 2015-05-01 2015-10-01 sustained
#>  6: WardX      7 2014-11-01 2015-03-01 2015-04-01 sustained
#>  7: WardY     19 2014-12-01 2015-04-01 2015-06-01 sustained
#>  8: WardZ      7 2015-01-01 2015-05-01 2015-12-01 sustained
#>  9: WardV     11 2015-10-01 2016-02-01 2018-07-01 sustained
#> 10: WardX     11 2015-04-01 2015-08-01 2016-12-01 sustained
#> 11: WardY     15 2015-06-01 2015-10-01 2017-10-01 sustained
#> 12: WardZ      4 2015-12-01 2016-04-01 2017-06-01 sustained
#> 13: WardX      5 2016-12-01 2017-04-01 2018-02-01 sustained
#> 14: WardY      7 2017-10-01 2018-02-01 2018-07-01 sustained
#> 15: WardZ      9 2017-06-01 2017-10-01 2018-07-01 sustained
#> 16: WardX      7 2018-02-01 2018-06-01 2018-07-01 sustained

Design decisions and similar packages

This package makes no attempt to identify or highlight ‘trends’ (consecutively increasing or decreasing points) or shorter ‘shifts’ of runs below the median. In 8 years of working with QI data, I very rarely see trends, and when they do appear, they tend to result after a period of process degradation, when the process begins to return back to its natural median state.

In addition, research by qicharts2 author Jacob Anhoej shows that the trend rule is not reliable. There are no plans to add tests to identify trends to the package.

However, analysts are often asked to apply all the run chart rules.
In this case, if you need to apply the rules for trend , and still have the ability to revise run chart medians, you should consider using the runchart package by Joseph Adams.

qicharts2 creates run and SPC charts. These can be rebased, but you must specify when to do so. Also, the analysis is based on the author’s own rules and not the rules typically used in healthcare (e.g. the rules promoted by the IHI).

Turn off run chart analysis

You can avoid rebasing medians by setting ‘runlength’ to 0 (zero). This will plot the runcharts with the original baseline medians, but no runs analysis will take place.

library(runcharter)
signals %>% 
  runcharter(med_rows = 13,
             runlength = 0, 
             datecol = date,
              grpvar = grp, 
              yval = y,
             direction = "both")
#> $runchart

#> 
#> $sustained
#>      grp median start_date   end_date  extend_to run_type
#> 1: WardV      7 2014-01-01 2015-01-01 2018-07-01 baseline
#> 2: WardX     11 2014-01-01 2015-01-01 2018-07-01 baseline
#> 3: WardY     13 2014-01-01 2015-01-01 2018-07-01 baseline
#> 4: WardZ      4 2014-01-01 2015-01-01 2018-07-01 baseline

Similarly, you can plot basic line charts by setting ‘med_rows’ to 0 (zero)

library(runcharter)
signals %>% 
  runcharter(med_rows = 0,
             runlength = 9, 
             datecol = date,
              grpvar = grp, 
              yval = y,
             direction = "both")
#> $runchart

#> 
#> $sustained
#>      grp median start_date   end_date  extend_to run_type
#> 1: WardV     NA 2014-01-01 2014-01-01 2018-07-01 baseline
#> 2: WardX     NA 2014-01-01 2014-01-01 2018-07-01 baseline
#> 3: WardY     NA 2014-01-01 2014-01-01 2018-07-01 baseline
#> 4: WardZ     NA 2014-01-01 2014-01-01 2018-07-01 baseline
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].