Statistical Process Control (SPC) R Packages

Statistical Process Control Resources

A quick introduction to the R packages available and how they are used by the team

Zoë Turner true
2022-06-24

Statistical Process Control (SPC)

SPCs are very popular in analysis in the NHS and we are lucky now to have many resources available to understand, produce and explain SPC charts. In the NHS the resources used for SPC are promoted through an initiative called the Making Data Count hosted by NHS England and Improvement who have a FuturesNHS Workspace of the same name and have templates in SQL and Excel.

R packages

qicharts2

Until very recently the main package used by the team has been {qicharts2}, available through CRAN, which has a really good vignette to get started. The package include many types of SPC including charts for rare events. The package creator, Jacob Anhøj, has also run workshops and given talks (1:45:23) at the NHS-R conferences.

Note that the run chart in qicharts2 uses an additional rule that Jacob Anhøj has written about in statistical journals and has blogged about more generally for the NHS-R Community.

NHSRplotthedots

In response to the work around Making Data Count, many analysts in the NHS were using R to produce SPC charts but wanted to change the colours/add logos and use the NHS England/Improvement rules. Through the NHS-R Community the analysts were able to work together in collaboration to produce the {NHSRplotthedots} package which is now on CRAN.

charter packages

John Mackintosh, an NHS data analyst/BI developer in Scotland, has created a series of charter packages that he uses in his work and has shared on GitHub and CRAN:

runcharter (github repository) CRAN cusumcharter (github repository) CRAN spccharter

These are particuarly good packages to use for analysing multiple charts at once.

Funnel Plots

Another form of SPC which is very useful and often appears in Public Health analysis is the funnel plot. Public Health England (now UKHSA) have a few resources on how touse and interpret funnel plots with a spreadsheet template and in R, the package {FunnelPlotR} has been created by Chris Mainey and can now be found on the NHS-R Community GitHub and is available on CRAN.

Corrections

If you see mistakes or want to suggest changes, please create an issue on the source repository.

Citation

For attribution, please cite this work as

Turner (2022, June 24). CDU data science team blog: Statistical Process Control (SPC) R Packages. Retrieved from https://cdu-data-science-team.github.io/team-blog/posts/2022-06-24-statistical-process-control-r-packages/

BibTeX citation

@misc{turner2022statistical,
  author = {Turner, Zoë},
  title = {CDU data science team blog: Statistical Process Control (SPC) R Packages},
  url = {https://cdu-data-science-team.github.io/team-blog/posts/2022-06-24-statistical-process-control-r-packages/},
  year = {2022}
}