shewhartr 1.3.0 (development version)
New chart family
The multivariate side of the package now has the natural pair of memory-based charts. Both follow the calibrate() / monitor() Phase I / Phase II workflow.
-
shewhart_mewma()— Multivariate Exponentially Weighted Moving Average (Lowry, Woodall, Champ & Rigdon 1992). The multivariate analogue ofshewhart_ewma(): joint monitoring ofp > 1correlated variables for small persistent shifts in the vector mean. Time-varying and steady-state covariance both supported. Decision intervalhcalibrated by lookup in Prabhu & Runger- Table 3 (
ARL_0 ~ 200).
- Table 3 (
-
shewhart_mcusum()— Multivariate CUSUM (Crosier 1988). The multivariate analogue ofshewhart_cusum(). Uses Crosier’s shrinkage operator: at each step the cumulative vector is shrunk towards zero byk / C_iwhereC_iis its Mahalanobis norm; if the norm falls belowk, the cumulative vector resets to zero. Decision intervalhcalibrated by lookup in Crosier (1988) Table 1 fork = 0.5,ARL_0 ~ 200,p = 2..10. Phase II monitoring continues from the calibration’s finalSvector (Crosier 1988 §5).
Visual identity
- Every
autoplot()method now usesshewhart_palette()andshewhart_theme(), so plots from any chart family share the same editorial look (off-white surface, single horizontal grid, bold left-aligned title, sequential phase palette, hollow firebrick rings on out-of-control points). Out-of-control marks centralised in a new internalviolation_layers()helper, sized at halo 1.7 / ring 1.4 / stroke 0.7. - Regression chart legend title is now plural and bold (“Phases” / “Fases”) and uses localised
Phase 0,Phase 1, … labels via thephase_nand newlegend_phaseslocale entries. - The
arl-simulationvignette’s hand-rolled chart was usingtheme_minimal()with default ggplot2 colours; now usesshewhart_theme()and the package palette so it matches the rest.
shewhartr 1.2.0
This release closes the remaining items from dev/ROADMAP.md §11 that were left for after v1.1: a plotly bridge and external numerical validation against the long-established qcc package.
Interactive plots: as_plotly()
- New generic
as_plotly()with ashewhart_chartmethod that converts any chart into an interactive plotly figure. For two-panel charts (I-MR, X̄-R, X̄-S) the helper produces aplotly::subplot()with a synchronised x-axis.plotlyis inSuggests, so it is only loaded on demand. - The
tooltipargument is forwarded toplotly::ggplotly()for full control of what hover boxes display.
Validation against qcc
- New
tests/testthat/test-vs-qcc.R(skipped silently ifqccis not installed) compares the limits computed byshewhartrto the reference values from theqccpackage on its canonical example datasets —pistonringsfor the variables charts,orangejuicefor p / np,circuitfor c. Every centre line and 3-sigma limit agrees withqccto within 1e-3 absolute tolerance.
shewhartr 1.1.0
This release closes most of the items left open in dev/ROADMAP.md §11.
New chart family: multivariate
-
shewhart_hotelling()is the package’s first multivariate chart — a HotellingT²chart for jointly monitoringp > 1correlated variables. Both individual observations (subgroup = NULL) and subgrouped data are supported, with the appropriate exact Phase I limits (Beta for individuals, F for subgroups) and the slightly wider Phase II limits as derived in Tracy, Young & Mason (1992) and Montgomery (2019, Chapter 11). The implementation follows Mason & Young (2002). - The augmented tibble carries the
T²statistic per row, its decomposition by variable (the contribution of each variable to the alarm — useful whenT²signals but no univariate chart does), and a logical flag against the appropriate chart-level UCL. - Vignette
multivariate-chartswalks through the standard worked example: a chemical process with three correlated quality characteristics, showing how the multivariate chart catches a correlation-breaking shift that any of the three univariate charts would miss.
Phase II for EWMA and CUSUM
-
monitor()now dispatches tomonitor_ewma()andmonitor_cusum()(R/calibrate.R), so thecalibrate(..., chart = "ewma")/monitor(new_data, calib)workflow now works uniformly across every chart in the package — not just the Shewhart-style ones. -
calibrate()accepts the new keys"ewma","cusum","hotelling".
shewhartr 1.0.0
This release is a comprehensive reposition of the package. The original (v0.1.x, distributed as Shewhart) was COVID-focused and provided a single function family for regression-based control charts. v1.0.0 is a full general-purpose SPC toolkit while preserving the regression-chart speciality that motivated the package.
Rename. As part of the reposition, the package has been renamed Shewhart → shewhartr to follow modern lowercase R-package conventions and to free the name “Shewhart” for the methodology in text and documentation. Update existing code with library(shewhartr) (formerly library(Shewhart)).
The API has been substantially redesigned. Existing scripts written against v0.1.x will not run unchanged.
Repositioning
- The package is now a general-purpose SPC toolkit. The COVID-19 use case is preserved as a vignette case study (
covid-recife), not as the organising principle. - The package competes in the same space as
qccandqicharts2, and emphasises five differentiators: tidyverse-native API, broom integration, regression-based charts as a first-class citizen, embedded methodology (ARL, Box-Cox, runs tests), and an explicit Phase I / Phase II workflow.
New chart families
- Variables:
shewhart_i_mr(),shewhart_xbar_r(),shewhart_xbar_s(). - Attributes:
shewhart_p(),shewhart_np(),shewhart_c(),shewhart_u(). The c and u charts acceptlimits = "poisson"for exact Poisson quantile limits rather than the normal approximation. - The flagship
shewhart_regression()replaces the oldshewhart()function with a cleaner API, an extensible model menu (auto,linear,log,loglog,gompertz,logistic, plus user formulas), automatic phase detection via configurable runs rules, and proper handling of irregular time grids. - Memory-based charts:
shewhart_ewma()(Roberts 1959) for the Exponentially Weighted Moving Average chart, with both time-varying and steady-state limits, andshewhart_cusum()(Page 1954) for the two-sided tabular CUSUM chart with configurable reference valuekand decision intervalh. Both fit in the same S3 / broom / autoplot pipeline as the classical charts.
New methodology
-
shewhart_runs()implements the eight Nelson rules (1984, 1985) plus a Western Electric “7 in a row” variant for backward compatibility. Rule sets are user-configurable on every chart. -
shewhart_arl()performs Monte Carlo Average Run Length simulation for arbitrary rule combinations. -
shewhart_box_cox()returns the profile log-likelihood, optimal lambda, and 95% CI in the Box & Cox (1964) tradition. -
shewhart_diagnostics()produces a five-panel Tukey-style residual diagnostic display. -
shewhart_capability()computes Cp/Cpk/Pp/Ppk with bootstrap confidence intervals. -
calibrate()andmonitor()provide an explicit Phase I / Phase II workflow.
S3 / broom integration
- All charts return an S3 object of class
shewhart_chartwith a specific subclass. -
print(),summary(),autoplot(),tidy(),glance()andaugment()methods are provided for every chart type.
Internationalisation
- All user-facing chart functions accept a
localeargument ("en","pt","es","fr") that controls plot labels and informative messages. Validation errors remain in English to facilitate cross-user debugging.
Developer-facing changes
-
Dependscollapsed: the package no longer depends on the entire tidyverse meta-package or ontibbletime/pals/scales. The newImportsare minimal and explicit. -
plotlymoved toSuggeststo avoid pulling a heavy dependency for users who don’t need interactive plots. - All input validation uses
cli::cli_abort()/cli::cli_warn()with multi-line, informative messages. -
.onAttach()no longer prints a banner. - New
data-raw/build_all.Rscript generates six synthetic datasets (tablet_weight,bottle_fill,pcb_solder,claims_p,temperature_drift,bacterial_growth). - New documentation site built with
pkgdownat https://castlaboratory.github.io/shewhartr/. Ten topical articles, including a dedicatedmemory-based-chartsvignette covering EWMA, CUSUM and the trade-offs versus Shewhart-style charts.
Breaking changes (full list)
-
shewhart()(the plotting function) has been removed. Useshewhart_regression()followed byautoplot(). -
shewhart_fit()is no longer exported. Useshewhart_regression(). -
shewhart_model()is no longer exported. Useshewhart_regression(). -
shewhart_7points()is no longer exported. Useshewhart_runs(rule = "we_seven_same")for the same behaviour, or the recommendedshewhart_runs(rule = "nelson_2_nine_same"). - The default phase-detection rule is now Nelson 2 (9 points same side; ARL_0 ~ 256), not the legacy 7-points-same-side (ARL_0 ~ 64). Pass
phase_rule = "we_seven_same"to recover the old behaviour. - The package banner printed on
.onAttach()has been removed. - All output column names follow broom-style with a leading
.(.fitted,.upper,.lower,.flag_*).