getRL {SNSchart}R Documentation

Run Length

Description

Get the run length

Usage

getRL(
  replica = 1,
  n,
  m,
  theta = NULL,
  Ftheta = NULL,
  dist,
  mu,
  sigma,
  dist.par = c(0, 1, 1),
  scoring = "Z",
  chart,
  chart.par,
  calibrate = FALSE,
  arl0 = 370,
  alignment = "unadjusted",
  constant = NULL,
  absolute = FALSE,
  isFixed = FALSE,
  Chi2corrector = "None",
  rounding.factor = NULL
)

Arguments

replica

scalar. It is used for the parallel version of the function (parallel=TRUE). Default 1.

n

scalar. Subroup size

m

scalar. Reference sample size

theta

scalar. Value corresponig with the Ftheta quantile.

Ftheta

scalar. Quantile of the data distribution. The values that take are between (0,1).

dist

character string. Select from:

  • "Uniform: Continuous Uniform distribution .

  • "Normal": Normal distribution (default).

  • "Normal2": Squared Normal distribution (also known as Chi-squared).

  • "DoubleExp": Double exponential distribution (also known as Laplace distribution).

  • "DoubleExp2": Double exponential squared distribution from a DoubleExp(0,1).

  • "LogNormal": Lognormal distribution.

  • "Gamma": Gamma distribution.

  • "Weibull": Weibull distribution.

  • "t": Student-t distribution.

mu

vector. Two elements, the first one is the mean of the reference sample and the second one is the mean of the monitoring sample.

sigma

vector. Two elements, the first one is the sd of the reference sample and the second one is the sd of the monitoring sample.

dist.par

vector. Distribution parameters. c(par.a, par.b). Default c(0,1).

scoring

character string. If "Z" (normal scores) (default). If "Z-SQ" (normal scores squared).

chart

character string. Selected type of chart. Three options are available: Shewhart, CUSUM, EWMA

chart.par

vector. The size depends on the selected chart:

Shewhart scheme:

is c(k), where k comes from UCL = mu + k\sigma, LCL = mu - k\sigma.

CUSUM scheme:

is c(k, h, t) where k is the reference value and h is the control limit, and t is the type of the chart (1:positive, 2:negative, 3:two sides)

EWMA scheme:

is c(lambda, L), where lambda is the smoothing constant and L multiplies standard deviation to get the control limit

calibrate

logical. If TRUE the RL is limit to 10 times the target ARL.

arl0

scalar. Expected value of the RL. Default 370.

alignment

character string. Aligment of the data X and Y. Select from

  • "unadjusted": nothing is sustracte from X and Y (default).

  • "overallmean": overall mean is sustracted from X and Y.

  • "overallmedian": overall median is sustracted from X and Y.

  • "samplemean": mean from corresponding group (X and Y) is sustracted from its corresponing vector.

  • "samplemedian": median from corresponding group (X and Y) is sustracted from its corresponing vector.

  • "referencemean": mean from Y is subtracted from X and Y.

  • "referencemedian": median from Y is subtracted from X and Y.

  • "constantvalue": a constant value is subtracted from X and Y.

constant

scalar. Only used when the alignment is selected "constantvalue". Default NULL.

absolute

logical. If TRUE, the absolute aligned values are obtained. (Default FALSE)

isFixed

logical. If TRUE the reference sample does not update, otherwise the reference sample is updated whenever the batch is in control.

Chi2corrector

character string. Only when scoring is Z-SQ. Select from

  • "approx: Z^2*(m + 1 + 1.3)/(m+1).

  • "exact": Z^2/mean(Z).

  • "none": Z^2.

If "approx" () (default). If "exact" (normal scores squared).

rounding.factor

scalar. positive value that determine the range between two consecutive rounded values.

Value

RL vector. The run length of the chart for the parameter setting.

Examples

n <- 5 # subgroup size
m <- 100 # reference-sample size
dist <- "Normal"
mu <- c(0, 0) # c(reference sample mean, monitoring sample mean)
sigma <- c(1, 1) # c(reference sample sd, monitoring sample sd)

#### Distribution parameters
dist.par <- c(0, 1, 1) # c(location, scale, shape)

#### Other Parameters
replicates <- 2
print.RL <- TRUE
calibrate <- FALSE
progress <- TRUE
arl0 <- 370

#### Control chart parameters
chart <- "Shewhart"
chart.par <- c(3)
shewhart <- getRL(1, n, m,
  theta = NULL, Ftheta = NULL,dist, mu, sigma, dist.par = dist.par,
  chart = chart, chart.par = chart.par, calibrate = calibrate, arl0 = arl0
)

chart <- "CUSUM"
chart.par <- c(0.25, 4.4181, 3)
cusum <- getRL(1, n, m,
  theta = NULL, Ftheta = NULL, dist, mu, sigma, dist.par = dist.par,
  chart = chart, chart.par = chart.par, calibrate = calibrate, arl0 = arl0
)

chart <- "EWMA"
chart.par <- c(0.2, 2.962)
shewhart <- getRL(1, n, m,
  theta = NULL, Ftheta = NULL,dist, mu, sigma, dist.par = dist.par,
  chart = chart, chart.par = chart.par, calibrate = calibrate, arl0 = arl0
)

[Package SNSchart version 1.4.0 Index]