Package: shewhartr 1.3.0

André Leite

shewhartr: Statistical Process Control with Tidyverse-Native Workflows

A comprehensive toolkit for Statistical Process Control (SPC) that combines the rigor of classical Shewhart methodology with modern tidyverse-native interfaces. Provides classical control charts for variables (I-MR, Xbar-R, Xbar-S) and attributes (p, np, c, u), as well as regression-based control charts for processes with trend. Includes Nelson runs tests, Average Run Length (ARL) simulation, process capability indices with bootstrap confidence intervals, Box-Cox transformation guidance, and a clean Phase I / Phase II workflow. All chart objects integrate with broom via 'tidy', 'glance' and 'augment' methods. References: Shewhart (1931, ISBN:0-87389-076-0); Montgomery (2019, ISBN:978-1-119-39930-8); Nelson (1984) <doi:10.1080/00224065.1984.11978921>; Woodall (2000) <doi:10.1080/00224065.2000.11980013>; Box & Cox (1964) <doi:10.1111/j.2517-6161.1964.tb00553.x>.

Authors:André Leite [aut, cre], Hugo Vasconcelos [aut], Raydonal Ospina [aut], Cristiano Ferraz [aut], Castlab [cph, fnd]

shewhartr_1.3.0.tar.gz
shewhartr_1.3.0.zip(r-4.7)shewhartr_1.3.0.zip(r-4.6)shewhartr_1.3.0.zip(r-4.5)
shewhartr_1.3.0.tgz(r-4.6-any)shewhartr_1.3.0.tgz(r-4.5-any)
shewhartr_1.3.0.tar.gz(r-4.7-any)shewhartr_1.3.0.tar.gz(r-4.6-any)
shewhartr_1.3.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
shewhartr/json (API)

# Install 'shewhartr' in R:
install.packages('shewhartr', repos = c('https://castlaboratory.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/castlaboratory/shewhartr/issues

Pkgdown/docs site:https://castlaboratory.github.io

Datasets:

On CRAN:

Conda:

4.92 score 15 scripts 506 downloads 35 exports 33 dependencies

Last updated from:d302b1b656. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK178
source / vignettesOK207
linux-release-x86_64OK176
macos-release-arm64OK164
macos-oldrel-arm64OK157
windows-develOK138
windows-releaseOK114
windows-oldrelOK104
wasm-releaseOK121

Exports:as_plotlybox_coxcalibratecolor_huefit_gompertz_dummyGompertzilogloginv_box_coxis_shewhart_chartloglogmonitorrolling_sumshewhart_arlshewhart_box_coxshewhart_cshewhart_capabilityshewhart_constantsshewhart_cusumshewhart_diagnosticsshewhart_ewmashewhart_hotellingshewhart_i_mrshewhart_mcusumshewhart_mewmashewhart_npshewhart_pshewhart_paletteshewhart_regressionshewhart_rules_availableshewhart_runsshewhart_themeshewhart_ushewhart_xbar_rshewhart_xbar_sSSgompertzDummy

Dependencies:backportsbroomclicpp11dplyrfarvergenericsggplot2gluegtableisobandlabelinglifecyclemagrittrpillarpkgconfigpurrrR6RColorBrewerrlangS7scalessliderstringistringrtibbletidyrtidyselectutf8vctrsviridisLitewarpwithr

Case study: epidemiological monitoring (COVID-19, Recife)
The data | A first attempt: classical I-MR | The right tool: regression chart with phase detection | Why log-log? | Methodological caveats | A note on the package's history | References

Last update: 2026-05-09
Started: 2026-05-06

Regression-based control charts
A simple example: linear drift | Sigma from residuals | Phase detection | A worked example with many phases and visible violations | The model menu | A growth-curve example | Interpreting violations | References

Last update: 2026-05-09
Started: 2026-05-06

ARL by Monte Carlo simulation
Closed-form benchmarks | Adding rules sharpens detection | A quantitative comparison: WE-7 vs Nelson 2 | Beyond normal residuals | References

Last update: 2026-05-07
Started: 2026-05-06

Memory-based charts: EWMA and CUSUM
When the Shewhart chart is too slow | EWMA — Exponentially Weighted Moving Average | Choosing lambda | CUSUM — Cumulative Sum | Choosing k and h | Phase II monitoring | Which one should I use? | References

Last update: 2026-05-07
Started: 2026-05-07

Multivariate charts: Hotelling T²
When univariate charts are not enough | What the chart computes | Diagnosing an alarm with contributions | Phase II workflow | When not to reach for a Hotelling chart | References

Last update: 2026-05-07
Started: 2026-05-07

Attributes charts: p, np, c, u
p chart with variable n | c chart and Poisson honesty | np chart for constant n | u chart for variable exposure | References

Last update: 2026-05-06
Started: 2026-05-06

Choosing a transformation: Box-Cox in practice
A textbook example | Interaction with shewhart_regression(model = "auto") | When not to transform | References

Last update: 2026-05-06
Started: 2026-05-06

Getting started with shewhartr
Five minutes, three charts | 1. An I-MR chart on individual measurements | 2. An Xbar-R chart on a subgrouped process | 3. A c chart on defect counts | Working with the result | Phase I and Phase II | A roadmap for the rest of the documentation | References

Last update: 2026-05-06
Started: 2026-05-06

Phase I and Phase II
A worked example | Phase I: calibration | Phase II: monitoring | Why the trim step matters | When this matters most | References

Last update: 2026-05-06
Started: 2026-05-06

Residual diagnostics, Tukey style
What the panels show | A diagnosis-driven fix: Box-Cox | When non-normality is a feature, not a bug | References

Last update: 2026-05-06
Started: 2026-05-06

Variables charts: I-MR, Xbar-R, Xbar-S
When to use which | I-MR | Robust alternatives | Xbar-R | Xbar-S | Reading the results | References

Last update: 2026-05-06
Started: 2026-05-06

Readme and manuals

Help Manual

Help pageTopics
Convert a Shewhart chart to an interactive plotly figureas_plotly as_plotly.default as_plotly.shewhart_chart
Augment new data with control-chart annotationsaugment.shewhart_chart
Plot a Shewhart chart with ggplot2autoplot.shewhart_chart
Bacterial growth curve (optical density)bacterial_growth
Bottle filling volumesbottle_fill
Apply / invert a Box-Cox power transformationbox_cox
Phase I calibration of a control chartcalibrate
Daily insurance claim error ratesclaims_p
Generate a qualitative HCL palettecolor_hue
COVID-19 daily mortality, Recife, Brazil, 2020cvd_recife
Convenience wrapper to fit 'SSgompertzDummy' to a data framefit_gompertz_dummy
Glance at a Shewhart chart's overall diagnosticsglance.shewhart_chart
Gompertz growth functionGompertz
Inverse log-log transformationiloglog
Inverse Box-Cox transformationinv_box_cox
Shewhart chart S3 classis_shewhart_chart shewhart_chart
Log-log transformationloglog
Phase II monitoring against pre-calibrated limitsmonitor
Solder defects on printed circuit boardspcb_solder
Print a Shewhart chart objectprint.shewhart_chart
Rolling sum with a configurable windowrolling_sum
Estimate Average Run Length via Monte Carlo simulationshewhart_arl
Box-Cox profile log-likelihoodshewhart_box_cox
c chart for the number of nonconformitiesshewhart_c
Process capability indices Cp, Cpk, Pp, Ppkshewhart_capability
Look up Shewhart control chart constantsshewhart_constants
Tabular CUSUM control chartshewhart_cusum
Tukey-style residual diagnostic panelshewhart_diagnostics
Exponentially Weighted Moving Average (EWMA) control chartshewhart_ewma
Hotelling T-squared multivariate control chartshewhart_hotelling
Individuals and Moving Range (I-MR) control chartshewhart_i_mr
Multivariate CUSUM control chart (Crosier 1988)shewhart_mcusum
Multivariate EWMA control chartshewhart_mewma
np chart for the number of nonconforming itemsshewhart_np
p chart for the proportion of nonconforming itemsshewhart_p
Access the package's named colour palettesshewhart_palette
Regression-based control chart for processes with trendshewhart_regression
List available runs rulesshewhart_rules_available
Apply runs tests to a chart object or to raw vectorsshewhart_runs
Editorial-style ggplot2 theme used by every autoplot.shewhart_*shewhart_theme
u chart for nonconformities per unit, variable inspection sizeshewhart_u
Xbar-R control chart for rational subgroupsshewhart_xbar_r
Xbar-S control chart for rational subgroupsshewhart_xbar_s
Self-starting Gompertz with an additive dummy termSSgompertzDummy
Compact tibble-like summarysummary.shewhart_chart
Pharmaceutical tablet weightstablet_weight
Curing oven temperature drifttemperature_drift
Tidy the control limits of a Shewhart charttidy.shewhart_chart