Package 'rbcc'

Title: Risk-Based Control Charts
Description: Implements univariate and multivariate risk-based control charts for statistical process control in the presence of measurement uncertainty. Available charts include Shewhart X-bar, R, and S charts, moving-average charts, exponentially weighted moving-average charts, cumulative-sum charts, and Hotelling T-squared charts. Chart parameters can be optimized by minimizing the total cost of the four decision outcomes. The methodology is described by Kosztyan and Katona (2016) <doi:10.1016/j.eswa.2016.06.019>, Kosztyan and Katona (2018) <doi:10.1016/j.cie.2018.04.052>, Katona et al. (2023) <doi:10.1109/ACCESS.2023.3312226>, Saghir et al. (2025) <doi:10.1016/j.rineng.2025.107278>, and Saghir et al. (2026) <doi:10.1016/j.rico.2026.100661>.
Authors: Aamir Saghir [aut], Attila Imre Katona [aut], Zsolt Tibor Kosztyan [aut, cre]
Maintainer: Zsolt Tibor Kosztyan <[email protected]>
License: GPL (>= 2)
Version: 0.2.0
Built: 2026-09-28 12:50:07 UTC
Source: https://github.com/kzst/rbcc

Help Index


Risk-Based Control Charts

Description

Tools for risk-based statistical process control in the presence of measurement uncertainty. The package evaluates four decision outcomes and optimizes chart parameters by minimizing total decision cost.

Details

Available charts include X-bar, R, S, moving-average, EWMA, CUSUM, and multivariate T-squared charts. See citation("rbcc") for references.

Author(s)

Aamir Saghir, Attila Imre Katona, and Zsolt Tibor Kosztyan.


Generate Data from the Pearson Distribution System

Description

Generate Data from the Pearson Distribution System

Usage

data_gen(
  obs,
  mu,
  va,
  sk,
  ku,
  seed = NULL,
  engine = c("auto", "pearson"),
  validate = TRUE
)

Arguments

obs

Positive number of observations per variable.

mu

Numeric vector of means.

va

Numeric vector of variances.

sk

Numeric vector of skewness coefficients.

ku

Numeric vector of kurtosis coefficients.

seed

Optional integer seed. The caller's random-number state is restored after generation.

engine

Either "auto" or "pearson".

validate

Logical; validate inputs.

Value

A numeric matrix with one column per variable.


Plot Risk-Based Control Charts

Description

Plot Risk-Based Control Charts

Usage

## S3 method for class 'rbcc'
plot(x, title = NULL, xlab = "Group", ylab = "Chart statistic", ...)

## S3 method for class 'rbcusumcc'
plot(x, title = NULL, xlab = "Group", ylab = "Cumulative sum", ...)

## S3 method for class 'rbmcc'
plot(x, title = NULL, xlab = "Group", ylab = "T-squared statistic", ...)

Arguments

x

A fitted risk-based chart object.

title

Optional title.

xlab, ylab

Axis labels.

...

Reserved for future use.

Value

A visible ggplot object.


Risk-Based Shewhart Control Chart

Description

Risk-Based Shewhart Control Chart

Usage

rbcc(
  X,
  UC,
  C,
  n,
  type = c("xbar", "R", "S"),
  confidence_level = 0.9973,
  K = 3,
  validate = TRUE
)

Arguments

X

Numeric process observations.

UC

Numeric additive measurement errors.

C

Four decision costs ordered as c11, c10, c01, c00.

n

Subgroup size. Defaults to one when omitted.

type

Chart type: "xbar", "R", or "S".

confidence_level

Traditional-chart confidence level.

K

Nonnegative risk-based limit coefficient.

validate

Logical; validate inputs.

Value

An object of class rbcc.


Construct Optimization Controls

Description

Construct Optimization Controls

Usage

rbcc_control(grid_size = 201L, tol = .Machine$double.eps^0.25)

Arguments

grid_size

Number of points used by the grid optimizer.

tol

Positive numerical tolerance.

Value

A list suitable for the control argument.


Optimize a Risk-Based Shewhart Control Chart

Description

Optimize a Risk-Based Shewhart Control Chart

Usage

rbcc_opt(
  X,
  UC,
  C,
  n,
  type = c("xbar", "R", "S"),
  confidence_level = 0.9973,
  K_init = 0,
  LKL = 0,
  UKL = 5,
  optimizer = c("exact", "optimize", "grid"),
  parallel = FALSE,
  workers = NULL,
  control = list(),
  validate = TRUE
)

Arguments

X

Numeric process observations.

UC

Numeric additive measurement errors.

C

Four decision costs ordered as c11, c10, c01, c00.

n

Subgroup size. Defaults to one when omitted.

type

Chart type: "xbar", "R", or "S".

confidence_level

Traditional-chart confidence level.

K_init

Initial or tie-breaking coefficient.

LKL, UKL

Lower and upper search bounds.

optimizer

One of "exact", "optimize", or "grid".

parallel

Logical; parallelize the grid optimizer.

workers

Optional worker count.

control

A list created by rbcc_control().

validate

Logical; validate inputs.

Value

An optimized rbcc object.


Risk-Based CUSUM Control Chart

Description

Risk-Based CUSUM Control Chart

Usage

rbcusumcc(X, UC, C, n = 1, T = 5, se.shift = 1, K = 5, validate = TRUE)

Arguments

X

Numeric process observations.

UC

Numeric additive measurement errors.

C

Four decision costs ordered as c11, c10, c01, c00.

n

Subgroup size. Defaults to one when omitted.

T

Positive traditional decision-interval coefficient.

se.shift

Positive standardized reference shift.

K

Nonnegative risk-based limit coefficient.

validate

Logical; validate inputs.


Optimize a Risk-Based CUSUM Control Chart

Description

Optimize a Risk-Based CUSUM Control Chart

Usage

rbcusumcc_opt(
  X,
  UC,
  C,
  n = 1,
  T = 5,
  se.shift = 1,
  K_init = 0,
  LKL = 0,
  UKL = 6,
  optimizer = c("exact", "optimize", "grid"),
  parallel = FALSE,
  workers = NULL,
  control = list(),
  validate = TRUE
)

Arguments

X

Numeric process observations.

UC

Numeric additive measurement errors.

C

Four decision costs ordered as c11, c10, c01, c00.

n

Subgroup size. Defaults to one when omitted.

T

Positive traditional decision-interval coefficient.

se.shift

Positive standardized reference shift.

K_init

Initial or tie-breaking coefficient.

LKL, UKL

Lower and upper search bounds.

optimizer

One of "exact", "optimize", or "grid".

parallel

Logical; parallelize the grid optimizer.

workers

Optional worker count.

control

A list created by rbcc_control().

validate

Logical; validate inputs.


Risk-Based EWMA Control Chart

Description

Risk-Based EWMA Control Chart

Usage

rbewmacc(
  X,
  UC,
  C,
  n = 1,
  lambada = 0.2,
  nsigmas = 3,
  K = 3,
  lambda = NULL,
  validate = TRUE
)

Arguments

X

Numeric process observations.

UC

Numeric additive measurement errors.

C

Four decision costs ordered as c11, c10, c01, c00.

n

Subgroup size. Defaults to one when omitted.

lambada

EWMA smoothing parameter; retained for compatibility.

nsigmas

Traditional EWMA limit coefficient.

K

Nonnegative risk-based limit coefficient.

lambda

Correctly spelled alias for lambada.

validate

Logical; validate inputs.


Optimize a Risk-Based EWMA Control Chart

Description

Optimize a Risk-Based EWMA Control Chart

Usage

rbewmacc_opt(
  X,
  UC,
  C,
  n = 1,
  lambada = 0.2,
  nsigmas = 3,
  K_init = 0,
  LKL = 0,
  UKL = 5,
  lambda = NULL,
  optimizer = c("exact", "optimize", "grid"),
  parallel = FALSE,
  workers = NULL,
  control = list(),
  validate = TRUE
)

Arguments

X

Numeric process observations.

UC

Numeric additive measurement errors.

C

Four decision costs ordered as c11, c10, c01, c00.

n

Subgroup size. Defaults to one when omitted.

lambada

EWMA smoothing parameter; retained for compatibility.

nsigmas

Traditional EWMA limit coefficient.

K_init

Initial or tie-breaking coefficient.

LKL, UKL

Lower and upper search bounds.

lambda

Correctly spelled alias for lambada.

optimizer

One of "exact", "optimize", or "grid".

parallel

Logical; parallelize the grid optimizer.

workers

Optional worker count.

control

A list created by rbcc_control().

validate

Logical; validate inputs.


Risk-Based Moving-Average Control Chart

Description

Risk-Based Moving-Average Control Chart

Usage

rbmacc(X, UC, C, n = 1, w = 2, K = 3, validate = TRUE)

Arguments

X

Numeric process observations.

UC

Numeric additive measurement errors.

C

Four decision costs ordered as c11, c10, c01, c00.

n

Subgroup size. Defaults to one when omitted.

w

Positive moving-average span.

K

Nonnegative risk-based limit coefficient.

validate

Logical; validate inputs.


Optimize a Risk-Based Moving-Average Control Chart

Description

Optimize a Risk-Based Moving-Average Control Chart

Usage

rbmacc_opt(
  X,
  UC,
  C,
  n = 1,
  w = 2,
  K_init = 0,
  LKL = 0,
  UKL = 5,
  optimizer = c("exact", "optimize", "grid"),
  parallel = FALSE,
  workers = NULL,
  control = list(),
  validate = TRUE
)

Arguments

X

Numeric process observations.

UC

Numeric additive measurement errors.

C

Four decision costs ordered as c11, c10, c01, c00.

n

Subgroup size. Defaults to one when omitted.

w

Positive moving-average span.

K_init

Initial or tie-breaking coefficient.

LKL, UKL

Lower and upper search bounds.

optimizer

One of "exact", "optimize", or "grid".

parallel

Logical; parallelize the grid optimizer.

workers

Optional worker count.

control

A list created by rbcc_control().

validate

Logical; validate inputs.


Risk-Based Multivariate T-Squared Control Chart

Description

Constructs a risk-based Hotelling T-squared control chart in the presence of additive measurement uncertainty.

Usage

rbmcc(
  X,
  UC,
  C,
  n = 1,
  confidence_level = 0.99,
  K = 0,
  validate = TRUE
)

Arguments

X

Numeric matrix of true process characteristics.

UC

Numeric matrix of additive measurement errors.

C

Four decision costs ordered as c11, c10, c01, c00.

n

Subgroup size.

confidence_level

Traditional-chart confidence level.

K

Correction subtracted from the traditional upper control limit.

validate

Logical; validate inputs.

Value

An object of class rbmcc.

References

Kosztyan, Z. T. and Katona, A. I. (2016). Risk-Based Multivariate Control Chart. Expert Systems with Applications, 62, 250–262. doi:10.1016/j.eswa.2016.06.019

Examples

data("t2uc")
X <- as.matrix(t2uc[, 1:2])
UC <- as.matrix(t2uc[, 5:6])
C <- c(1, 20, 160, 5)
fit <- rbmcc(X, UC, C)
fit$cost0

Optimize a Risk-Based Multivariate T-Squared Control Chart

Description

Optimize a Risk-Based Multivariate T-Squared Control Chart

Usage

rbmcc_opt(
  X,
  UC,
  C,
  n = 1,
  confidence_level = 0.99,
  K_init = 0,
  LKL = -5,
  UKL = 5,
  optimizer = c("exact", "optimize", "grid"),
  parallel = FALSE,
  workers = NULL,
  control = list(),
  validate = TRUE
)

Arguments

X

Numeric matrix of true process characteristics.

UC

Numeric matrix of additive measurement errors.

C

Four decision costs ordered as c11, c10, c01, c00.

n

Subgroup size.

confidence_level

Traditional-chart confidence level.

K_init

Initial or tie-breaking correction.

LKL, UKL

Lower and upper correction bounds.

optimizer

One of "exact", "optimize", or "grid".

parallel

Logical; parallelize the grid optimizer.

workers

Optional worker count.

control

A list created by rbcc_control().

validate

Logical; validate inputs.

Value

An optimized rbmcc object.


Summarize Risk-Based Control-Chart Objects

Description

Summarize Risk-Based Control-Chart Objects

Usage

## S3 method for class 'rbcc'
summary(object, ...)

## S3 method for class 'rbcusumcc'
summary(object, ...)

## S3 method for class 'rbmcc'
summary(object, ...)

Arguments

object

A fitted risk-based chart object.

...

Reserved for future use.

Value

A structured summary object retaining all original components.


Brake-Cylinder Measurement Data

Description

Measurements of two brake-cylinder characteristics obtained with a high-precision optical system and production measurement devices. Measurement errors are the differences between production and optical measurements.

Usage

data("t2uc")

Format

A data frame with 50 observations and six numeric variables:

length_optical

Optical cutting-length measurement in millimeters.

diameter_optical

Optical main-diameter measurement in millimeters.

length_manual

Manual cutting-length measurement in millimeters.

diameter_manual

Manual main-diameter measurement in millimeters.

length_error

Manual minus optical cutting-length measurement.

diameter_error

Manual minus optical main-diameter measurement.

Source

Automotive-industry measurement study.

References

Katona, A. I. (2021). Validation of Risk-Based Quality Control Techniques: A Case Study from the Automotive Industry. Journal of Applied Statistics.

Examples

data("t2uc")
X <- as.matrix(t2uc[, 1:2])
UC <- as.matrix(t2uc[, 5:6])
fit <- rbmcc_opt(X, UC, c(1, 20, 160, 5))
fit$cost0