u-analytics
Statistical process control, process capability analysis, Weibull reliability, change-point detection, correlation, regression, distribution analysis, and hypothesis testing for industrial quality engineering.
Modules
| Module | Description |
|---|---|
spc |
Control charts (X̄-R, X̄-S, I-MR, P, NP, C, U, Laney P'/U', G, T) with Nelson/WE run rules |
capability |
Process capability indices (Cp, Cpk, Pp, Ppk, Cpm), sigma level, and Box-Cox non-normal capability |
weibull |
Weibull parameter estimation (MLE, MRR) and reliability analysis (R(t), MTBF, B-life) |
detection |
Change-point detection (CUSUM, EWMA) |
smoothing |
Time series smoothing (SES, Holt linear trend, Holt-Winters seasonal) |
correlation |
Correlation analysis (Pearson, Spearman, Kendall, partial, correlation matrices) |
regression |
Regression analysis (simple OLS, multiple OLS, VIF multicollinearity) |
distribution |
Distribution analysis (ECDF, histogram bins — Sturges/Scott/FD, QQ-plot, KS test) |
testing |
Hypothesis testing (t-tests, ANOVA, chi-squared, normality — SW/AD/JB) |
Features
Statistical Process Control (SPC)
Control charts for monitoring process stability:
- Variables charts: X̄-R, X̄-S, Individual-MR
- Attributes charts: P, NP, C, U
- Overdispersion-adjusted: Laney P' and U' (φ coefficient corrects for between-subgroup variation)
- Rare events: G chart (geometric distribution) and T chart (exponential) for low-defect processes
- Run rules: Nelson (8 rules), Western Electric (4 rules)
use ;
let mut chart = new;
chart.add_sample;
chart.add_sample;
chart.add_sample;
if chart.is_in_control
use ;
// Laney P' chart for overdispersed proportion data
// samples: (defective count, subgroup size)
let samples = vec!;
let chart = laney_p_chart.unwrap;
println!;
// G chart for rare events (e.g., days between nonconformances)
let inter_event_counts = vec!;
let gchart = g_chart.unwrap;
Process Capability
Capability indices quantifying process performance against specifications:
- Short-term: Cp, Cpk, Cpu, Cpl
- Long-term: Pp, Ppk, Ppu, Ppl
- Taguchi: Cpm
- Sigma level: PPM ↔ sigma conversion (1.5σ shift convention)
- Non-normal: Box-Cox transformation + capability on transformed scale
use ;
let spec = new.unwrap;
let data = ;
let indices = spec.compute.unwrap;
println!;
println!; // 3.4
use boxcox_capability;
// Non-normal data: auto-estimate λ, transform spec limits, compute Ppk
let skewed_data = vec!;
let result = boxcox_capability.unwrap;
println!;
Weibull Reliability
Parameter estimation and reliability engineering metrics:
- MLE: Maximum Likelihood Estimation (Newton-Raphson)
- MRR: Median Rank Regression (Bernard's approximation)
- Reliability: R(t), hazard rate, MTBF, B-life
use ;
let failure_times = ;
let fit = weibull_mle.unwrap;
let ra = from_mle;
println!;
println!;
println!;
Change-Point Detection
Algorithms for detecting process mean shifts:
- CUSUM: Cumulative Sum chart (Page, 1954)
- EWMA: Exponentially Weighted Moving Average (Roberts, 1959)
use Cusum;
let cusum = new.unwrap;
let data = ;
let signals = cusum.signal_points;
Test Status
446 lib tests + 68 doc-tests = 514 total
0 clippy warnings
Dependencies
u-numflow-- statistics, special functions, probability distributions
References
- Montgomery, D.C. (2019). Introduction to Statistical Quality Control, 8th ed.
- Nelson, L.S. (1984). "The Shewhart Control Chart -- Tests for Special Causes"
- Abernethy, R.B. (2006). The New Weibull Handbook, 5th ed.
- Page, E.S. (1954). "Continuous Inspection Schemes", Biometrika
- Roberts, S.W. (1959). "Control Chart Tests Based on Geometric Moving Averages"
- Laney, D.B. (2002). "Improved Control Charts for Attributes", Quality Engineering 14(4), 531–537
- Stephens, M.A. (1974). "EDF Statistics for Goodness of Fit", JASA 69(347), 730–737
- Box, G.E.P. & Cox, D.R. (1964). "An Analysis of Transformations", JRSS-B 26(2), 211–252
Related
- u-numflow -- Mathematical primitives
- u-insight -- Statistical analysis engine with C FFI
- u-metaheur -- Metaheuristic algorithms
- u-geometry -- Computational geometry
- u-schedule -- Scheduling framework
License
MIT