Who uses Statistical Process Control charts?
(or run charts and funnel plots)
Who has used qicharts2 package in R?
February 2020
Who uses Statistical Process Control charts?
(or run charts and funnel plots)
Who has used qicharts2 package in R?
install.packages("qicharts2") library(qicharts2)
Available on CRAN
Comes with sample healthcare datasets
Created by Jacob Anhøj, a doctor in Denmark
Supercedes qichart package
I skim instructions
I just get healthcare data (not plants and certainly not cars)
Reproducible examples in the vignette
More than one type of SPC available
Copied data manually from: https://understandinguncertainty.org/node/214
library(datapasta) to copy directly to R
Saved in a script for quick retrieval later
source("Crimea.R")
install.packages("HistData") library(HistData) data("Nightingale")
Built on ggplot2
qic(startMonth,number, data = crimeaLong, chart = 'run', decimals = 0, x.angle = 90, title = 'Run chart deaths in Crimea War', ylab = 'Number of deaths', xlab = 'Month' )
Producing…
30 incident categories
10 wards
25 LSOAs
To look for signals
qic(startMonth,number, data = crimeaLong, chart = 'run', decimals = 0, x.angle = 90, title = 'Run chart deaths in Crimea War', ylab = 'Number of deaths', xlab = 'Month' )
qic(startMonth,number, data = crimeaLong, chart = 'run', decimals = 0, facets = ~death_cause, x.angle = 90, title = 'Run chart deaths in Crimea War', ylab = 'Number of deaths', xlab = 'Month' )
qic(startMonth,number, data = crimeaLong, chart = 'mr', decimals = 0, facet = ~death_cause, x.angle = 90, title = 'SPC mr chart deaths in Crimea War', ylab = 'Number of deaths', xlab = 'Month' )
As seen on Twitter @Letxuga007
The code requires a count of days difference.
Cabg = coronary artery bypass operations
# Altered slightly from the vignette fatalities <- cabg %>% filter(death) %>% mutate(dt = date - lag(date))
A point above the upper control limit is a good thing!
The numbers generated to create the charts can be viewed/saved by typing:
newObject <- tchart$data
In this blog: https://www.r-bloggers.com/backed-by-data/ @_johnmackintosh shows how to:
And I used this code
Jacob has created this Flexdashboard https://hospinf.shinyapps.io/hospinf/
SPC Shiny dashboards are being discussed on the NHS-R Slack site
link: nhsrcommunity.slack.com
Follow the hashtag #rstats