Package SPC': R Topics Documented
Package SPC': R Topics Documented
Package SPC': R Topics Documented
R topics documented:
dphat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
lns2ewma.arl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
lns2ewma.crit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
mewma.arl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
mewma.crit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
mewma.psi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
p.ewma.arl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
phat.ewma.arl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
quadrature.nodes.weights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1
2 R topics documented:
scusum.arl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
scusum.crit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
scusums.arl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
sewma.arl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
sewma.arl.prerun . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
sewma.crit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
sewma.crit.prerun . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
sewma.q . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
sewma.q.prerun . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
sewma.sf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
sewma.sf.prerun . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
tol.lim.fac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
x.res.ewma.arl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
xcusum.ad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
xcusum.arl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
xcusum.crit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
xcusum.crit.L0h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
xcusum.crit.L0L1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
xcusum.q . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
xcusum.sf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
xDcusum.arl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
xDewma.arl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
xDgrsr.arl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
xDshewhartrunsrules.arl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
xewma.ad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
xewma.arl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
xewma.arl.f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
xewma.arl.prerun . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
xewma.crit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
xewma.q . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
xewma.q.prerun . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
xewma.sf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
xewma.sf.prerun . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
xgrsr.ad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
xgrsr.arl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
xgrsr.crit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
xsewma.arl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
xsewma.crit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
xsewma.q . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
xsewma.sf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
xshewhart.ar1.arl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
xshewhartrunsrules.arl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
xtcusum.arl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
xtewma.ad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
xtewma.arl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
xtewma.q . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
xtewma.sf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
xtshewhart.ar1.arl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
dphat 3
Index 121
Description
Density, distribution function and quantile function for the sample percent defective calculated on
normal samples with mean equal to mu and standard deviation equal to sigma.
Usage
dphat(x, n, mu=0, sigma=1, type="known", LSL=-3, USL=3, nodes=30)
Arguments
x, q vector of quantiles.
p vector of probabilities.
n sample size.
mu, sigma parameters of the underlying normal distribution.
type choose whether the standard deviation is given and fixed ("known") or estimated
and potententially monitored ("estimated").
LSL,USL lower and upper specification limit, respectively.
nodes number of quadrature nodes needed for type="estimated".
Details
Bruhn-Suhr/Krumbholz (1990) derived the cumulative distribution function of the sample per-
cent defective calculated on normal samples to applying them for a new variables sampling plan.
These results were heavily used in Krumbholz/Z\"oller (1995) for Shewhart and in Knoth/Steinmetz
(2013) for EWMA control charts. For algorithmic details see, essentially, Bruhn-Suhr/Krumbholz
(1990). Two design variants are treated: The simple case, type="known", with known normal vari-
ance and the presumably much more relevant and considerably intricate case, type="estimated",
where both parameters of the normal distribution are unknown. Basically, given lower and upper
specification limits and the normal distribution, one estimates the expected yield based on a normal
sample of size n.
Value
Returns vector of pdf, cdf or qf values for the statistic phat.
4 lns2ewma.arl
Author(s)
Sven Knoth
References
M. Bruhn-Suhr and W. Krumbholz (1990), A new variables sampling plan for normally distributed
lots with unknown standard deviation and double specification limits, Statistical Papers 31(1), 195-
207.
W. Krumbholz and A. Z\"oller (1995), p-Karten vom Shewhartschen Typ f\"ur die messende Pr\"ufung,
Allgemeines Statistisches Archiv 79, 347-360.
S. Knoth and S. Steinmetz (2013), EWMA p charts under sampling by variables, International
Journal of Production Research 51(13), 3795-3807.
See Also
phat.ewma.arl for routines using the herewith considered phat statistic.
Examples
# Figures 1 (c) and (d) from Knoth/Steinmetz (2013)
n <- 5
LSL <- -3
USL <- 3
par(mar=c(5, 5, 1, 1) + 0.1)
p.star <- 2*pnorm( (LSL-USL)/2 ) # for p <= p.star pdf and cdf vanish
# Figure 1 (c)
pp_ <- pphat(p_, n)
plot(p_, pp_, type="l", xlab="p", ylab=expression(P( hat(p) <= p )),
xlim=c(0, 0.06), ylim=c(0,1), lwd=2)
abline(h=0:1, v=p.star, col="grey")
# Figure 1 (d)
dp_ <- dphat(p_, n)
plot(p_, dp_, type="l", xlab="p", ylab="f(p)", xlim=c(0, 0.06),
ylim=c(0,50), lwd=2)
abline(h=0, v=p.star, col="grey")
Description
Computation of the (zero-state) Average Run Length (ARL) for different types of EWMA control
charts (based on the log of the sample variance S 2 ) monitoring normal variance.
lns2ewma.arl 5
Usage
lns2ewma.arl(l,cl,cu,sigma,df,hs=NULL,sided="upper",r=40)
Arguments
Details
lns2ewma.arl determines the Average Run Length (ARL) by numerically solving the related ARL
integral equation by means of the Nystroem method based on Gauss-Legendre quadrature.
Value
Author(s)
Sven Knoth
References
S. V. Crowder and M. D. Hamilton (1992), An EWMA for monitoring a process standard deviation,
Journal of Quality Technology 24, 12-21.
S. Knoth (2005), Accurate ARL computation for EWMA-S 2 control charts, Statistics and Comput-
ing 15, 341-352.
See Also
xewma.arl for zero-state ARL computation of EWMA control charts for monitoring normal mean.
6 lns2ewma.arl
Examples
## Crowder/Hamilton (1992)
## moments of ln S^2
E_log_gamma <- function(df) log(2/df) + digamma(df/2)
V_log_gamma <- function(df) trigamma(df/2)
E_log_gamma_approx <- function(df) -1/df - 1/3/df^2 + 2/15/df^4
V_log_gamma_approx <- function(df) 2/df + 2/df^2 + 4/3/df^3 - 16/15/df^5
df <- 4
lambda <- .05
K <- 1.06
cu <- K * sqrt( lambda/(2-lambda) * V_log_gamma_approx(df) )
## Knoth (2005)
## compare with Table 3 (p. 351)
lambda <- .05
df <- 4
K <- 1.05521
cu <- 1.05521 * sqrt( lambda/(2-lambda) * V_log_gamma_approx(df) )
M <- -0.267
cuM <- lns2ewma.crit(lambda, 200, df, cl=M, hs=M, r=60)[2]
arls1 <- round(lns2ewma.ARL(lambda, 0, cu, sigmas, df, hs=0, sided="upper"), digits=2)
arls2 <- round(lns2ewma.ARL(lambda, M, cuM, sigmas, df, hs=M, sided="upper", r=60), digits=2)
lns2ewma.crit 7
Description
Computation of the critical values (similar to alarm limits) for different types of EWMA control
charts (based on the log of the sample variance S 2 ) monitoring normal variance.
Usage
lns2ewma.crit(l,L0,df,sigma0=1,cl=NULL,cu=NULL,hs=NULL,sided="upper",mode="fixed",r=40)
Arguments
l smoothing parameter lambda of the EWMA control chart.
L0 in-control ARL.
df actual degrees of freedom, corresponds to subsample size (for known mean it
is equal to the subsample size, for unknown mean it is equal to subsample size
minus one.
sigma0 in-control standard deviation.
cl deployed for sided="upper", that is, upper variance control chart with lower
reflecting barrier cl.
cu for two-sided (sided="two") and fixed upper control limit (mode="fixed"), for
all other cases cu is ignored.
hs so-called headstart (enables fast initial response) – the default value (hs=NULL)
corresponds to the in-control mean of ln S 2 .
sided distinguishes between one- and two-sided two-sided EWMA-S 2 control charts
by choosing "upper" (upper chart with reflection at cl), "lower" (lower chart
with reflection at cu), and "two" (two-sided chart), respectively.
mode only deployed for sided="two" – with "fixed" an upper control limit (see cu)
is set and only the lower is calculated to obtain the in-control ARL L0, while with
"unbiased" a certain unbiasedness of the ARL function is guaranteed (here,
both the lower and the upper control limit are calculated). With "vanilla"
limits symmetric around the in-control mean of ln S 2 are determined, while for
"eq.tails" the in-control ARL values of two single EWMA variance charts
(decompose the two-sided scheme into one lower and one upper scheme) are
matched.
r dimension of the resulting linear equation system: the larger the more accurate.
8 lns2ewma.crit
Details
lns2ewma.crit determines the critical values (similar to alarm limits) for given in-control ARL L0
by applying secant rule and using lns2ewma.arl(). In case of sided="two" and mode="unbiased"
a two-dimensional secant rule is applied that also ensures that the maximum of the ARL function
for given standard deviation is attained at sigma0. See Knoth (2010) and the related example.
Value
Author(s)
Sven Knoth
References
C. A. Acosta-Mej\’ia and J. J. Pignatiello Jr. and B. V. Rao (1999), A comparison of control charting
procedures for monitoring process dispersion, IIE Transactions 31, 569-579.
S. V. Crowder and M. D. Hamilton (1992), An EWMA for monitoring a process standard deviation,
Journal of Quality Technology 24, 12-21.
S. Knoth (2005), Accurate ARL computation for EWMA-S 2 control charts, Statistics and Comput-
ing 15, 341-352.
S. Knoth (2010), Control Charting Normal Variance – Reflections, Curiosities, and Recommen-
dations, in Frontiers in Statistical Quality Control 9, H.-J. Lenz and P.-T. Wilrich (Eds.), Physica
Verlag, Heidelberg, Germany, 3-18.
See Also
Examples
## Knoth (2005)
## compare with Table 3 (p. 351)
L0 <- 200
l <- .05
df <- 4
limits <- lns2ewma.crit(l, L0, df, cl=0, hs=0)
limits["cu"]
mewma.arl 9
Description
Computation of the (zero-state) Average Run Length (ARL) for multivariate exponentially weighted
moving average (MEWMA) charts monitoring multivariate normal mean.
Usage
mewma.arl(l, cE, p, delta=0, hs=0, r=20, ntype=NULL, qm0=20, qm1=qm0)
mewma.ad(l, cE, p, delta=0, r=20, n=20, type="cond", hs=0, ntype=NULL, qm0=20, qm1=qm0)
Arguments
l smoothing parameter lambda of the MEWMA control chart.
cE alarm threshold of the MEWMA control chart.
p dimension of multivariate normal distribution.
delta magnitude of the potential change, delta=0 refers to the in-control state.
hs so-called headstart (enables fast initial response) – must be non-negative.
r number of quadrature nodes – dimension of the resulting linear equation system
for delta = 0. For non-zero delta this dimension is mostly r^2 (Markov chain
approximation leads to some larger values). Caution: If ntype is set to "co"
(collocation), then values of r larger than 20 lead to large computing times. For
the other selections this would happen for values larger than 40.
ntype choose the numerical algorithm to solve the ARL integral equation. For delta=0:
Possible values are "gl", "gl2" (gauss-legendre, classic and with variables
change: square), "co" (collocation, for delta > 0 with sin transformation),
"ra" (radau), "cc" (clenshaw-curtis), "mc" (markov chain), and "sr" (simp-
son rule). For delta larger than 0, some more values besides the others are
possible: "gl3", "gl4", "gl5" (gauss-legendre with a further change in vari-
ables: sin, tan, sinh), "co2", "co3" (collocation with some trimming and tan
as quadrature stabilizing transformations, respectively). If it is set to NULL (the
default), then for delta=0 then "gl2" is chosen. If delta larger than 0, then for
p equal 2 or 4 "gl3" and for all other values "gl5" is taken. "ra" denotes the
method used in Rigdon (1995a). "mc" denotes the Markov chain approximation.
type switch between "cond" and "cycl" for differentiating between the conditional
(no false alarm) and the cyclical (after false alarm re-start in hs), respectively.
n number of quadrature nodes for Calculating the steady-state ARL integral(s).
qm0,qm1 number of collocation quadrature nodes for the out-of-control case (qm0 for the
inner integral, qm1 for the outer one), that is, for positive delta, and for the in-
control case (now only qm0 is deployed) if via ntype the collocation procedure
is requested.
10 mewma.arl
Details
Basically, this is the implementation of different numerical algorithms for solving the integral equa-
tion for the MEWMA in-control (delta = 0) ARL introduced in Rigdon (1995a) and out-of-control
(delta != 0) ARL in Rigdon (1995b). Most of them are nothing else than the Nystroem approach –
the integral is replaced by a suitable quadrature. Here, the Gauss-Legendre (more powerful), Radau
(used by Rigdon, 1995a), Clenshaw-Curtis, and Simpson rule (which is really bad) are provided.
Additionally, the collocation approach is offered as well, because it is much better for small odd
values for p. FORTRAN code for the Radau quadrature based Nystroem of Rigdon (1995a) was
published in Bodden and Rigdon (1999) – see also http://lib.stat.cmu.edu/jqt/31-1. Fur-
thermore, FORTRAN code for the Markov chain approximation (in- and out-ot-control) could be
found at
http://lib.stat.cmu.edu/jqt/33-4. The related papers are Runger and Prabhu (1996) and Molnau et al.
(2001). The idea of the Clenshaw-Curtis quadrature was taken from Capizzi and Masarotto (2010),
who successfully deployed a modified Clenshaw-Curtis quadrature to calculate the ARL of com-
bined (univariate) Shewhart-EWMA charts. It turns out that it works also nicely for the MEWMA
ARL. The version mewma.arl.f() without the argument hs provides the ARL as function of one
(in-control) or two (out-of-control) arguments.
Value
Returns a single value which is simply the zero-state ARL.
Author(s)
Sven Knoth
References
Kevin M. Bodden and Steven E. Rigdon (1999), A program for approximating the in-control ARL
for the MEWMA chart, Journal of Quality Technology 31(1), 120-123.
Giovanna Capizzi and Guido Masarotto (2010), Evaluation of the run-length distribution for a com-
bined Shewhart-EWMA control chart, Statistics and Computing 20(1), 23-33.
Sven Knoth (2017), ARL Numerics for MEWMA Charts, Journal of Quality Technology 49(1),
78-89.
Wade E. Molnau et al. (2001), A Program for ARL Calculation for Multivariate EWMA Charts,
Journal of Quality Technology 33(4), 515-521.
Sharad S. Prabhu and George C. Runger (1997), Designing a multivariate EWMA control chart,
Journal of Quality Technology 29(1), 8-15.
Steven E. Rigdon (1995a), An integral equation for the in-control average run length of a multi-
variate exponentially weighted moving average control chart, J. Stat. Comput. Simulation 52(4),
351-365.
Steven E. Rigdon (1995b), A double-integral equation for the average run length of a multivariate
exponentially weighted moving average control chart, Stat. Probab. Lett. 24(4), 365-373.
George C. Runger and Sharad S. Prabhu (1996), A Markov Chain Model for the Multivariate Expo-
nentially Weighted Moving Averages Control Chart, J. Amer. Statist. Assoc. 91(436), 1701-1706.
mewma.arl 11
See Also
mewma.crit for getting the alarm threshold to attain a certain in-control ARL.
Examples
# Rigdon (1995a), p. 357, Tab. 1
p <- 2
r <- 0.25
h4 <- c(8.37, 9.90, 11.89, 13.36, 14.82, 16.72)
for ( i in 1:length(h4) ) cat(paste(h4[i], "\t", round(mewma.arl(r, h4[i], p, ntype="ra")), "\n"))
r <- 0.1
h4 <- c(6.98, 8.63, 10.77, 12.37, 13.88, 15.88)
for ( i in 1:length(h4) ) cat(paste(h4[i], "\t", round(mewma.arl(r, h4[i], p, ntype="ra")), "\n"))
p <- 5
h <- 14.56
for ( sdelta in c(0, 0.125, 0.25, .5, 1, 2, 3) )
cat(paste(sdelta, "\t",
round(mewma.arl(r, h, p, delta=sdelta^2, ntype="ra", r=25), digits=2), "\n"))
p <- 10
h <- 22.67
for ( sdelta in c(0, 0.125, 0.25, .5, 1, 2, 3) )
cat(paste(sdelta, "\t",
round(mewma.arl(r, h, p, delta=sdelta^2, ntype="ra", r=25), digits=2), "\n"))
## End(Not run)
p <- 20
H <- 37.01
cat(paste(0, "\t",
round(mewma.arl(r, H, p, delta=0, ntype="mc", r=50), digits=2), "\n"))
for ( delta in c(.5, 1, 1.5, 2, 3) )
cat(paste(delta, "\t",
round(mewma.arl(r, H, p, delta=delta, ntype="mc", r=25), digits=2), "\n"))
# compare with Fortran program (MEWMA-ARLs.f90) from Molnau et al. (2001) with m1 = m2 = 25
# H4 P R DEL ARL
# 37.01 20. 0.10 0.00 199.09
# 37.01 20. 0.10 0.50 61.62
# 37.01 20. 0.10 1.00 20.17
# 37.01 20. 0.10 1.50 11.40
# 37.01 20. 0.10 2.00 8.03
# 37.01 20. 0.10 3.00 5.18
## End(Not run)
## End(Not run)
# better accuracy
for ( delta in c(0, .5, 1, 1.5, 2, 3) )
mewma.crit 13
cat(paste(delta, "\t",
round(mewma.ad(r, H, p, delta=delta^2, type="cycl", r=30), digits=2), "\n"))
## End(Not run)
Description
Computation of the alarm threshold for multivariate exponentially weighted moving average (MEWMA)
charts monitoring multivariate normal mean.
Usage
mewma.crit(l, L0, p, hs=0, r=20)
Arguments
l smoothing parameter lambda of the MEWMA control chart.
L0 in-control ARL.
p dimension of multivariate normal distribution.
hs so-called headstart (enables fast initial response) – must be non-negative.
r number of quadrature nodes – dimension of the resulting linear equation system.
Details
mewma.crit determines the alarm threshold of for given in-control ARL L0 by applying secant rule
and using mewma.arl() with ntype="gl2".
Value
Returns a single value which resembles the critical value c.
Author(s)
Sven Knoth
References
Sven Knoth (2017), ARL Numerics for MEWMA Charts, Journal of Quality Technology 49(1),
78-89.
Steven E. Rigdon (1995), An integral equation for the in-control average run length of a multivariate
exponentially weighted moving average control chart, J. Stat. Comput. Simulation 52(4), 351-365.
14 mewma.psi
See Also
mewma.arl for zero-state ARL computation.
Examples
# Rigdon (1995), p. 358, Tab. 1
p <- 4
L0 <- 500
r <- .25
h4 <- mewma.crit(r, L0, p)
h4
## original value is 16.38.
Description
Computation of the (zero-state) steady-state density function of the statistic deployed in multivariate
exponentially weighted moving average (MEWMA) charts monitoring multivariate normal mean.
Usage
mewma.psi(l, cE, p, type="cond", hs=0, r=20)
Arguments
l smoothing parameter lambda of the MEWMA control chart.
cE alarm threshold of the MEWMA control chart.
p dimension of multivariate normal distribution.
type switch between "cond" and "cycl" for differentiating between the conditional
(no false alarm) and the cyclical (after false alarm re-start in hs), respectively.
hs the re-starting point for the cyclical steady-state framework.
r number of quadrature nodes.
p.ewma.arl 15
Details
Basically, ideas from Knoth (2017, MEWMA numerics) and Knoth (2016, steady-state ARL con-
cepts) are merged. More details will follow.
Value
Returns a function.
Author(s)
Sven Knoth
References
Sven Knoth (2016), The Case Against the Use of Synthetic Control Charts, Journal of Quality
Technology 48(2), 178-195.
Sven Knoth (2017), ARL Numerics for MEWMA Charts, Journal of Quality Technology 49(1),
78-89.
Sven Knoth (2018), The Steady-State Behavior of Multivariate Exponentially Weighted Moving
Average Control Charts, unpublished manuscript.
See Also
mewma.arl for calculating the in-control ARL of MEWMA.
Examples
lambda <- 0.1
L0 <- 1000
p <- 3
h4 <- mewma.crit(lambda, L0, p)
x_ <- seq(0, h4*lambda/(2-lambda), by=0.002)
psi <- mewma.psi(lambda, h4, p)
psi_ <- psi(x_)
#plot(x_, psi_, type="l", xlab="x", ylab=expression(psi(x)))
Description
Computation of the (zero-state) Average Run Length (ARL) at given rate p.
Usage
p.ewma.arl(lambda, ucl, n, p, z0, d.res=1, r.mode="ieee.round", i.mode="integer")
16 p.ewma.arl
Arguments
lambda smoothing parameter of the EWMA p control chart.
ucl upper control limit of the EWMA p control chart.
n subgroup size.
p (failure/success) rate.
z0 so-called headstart (give fast initial response).
d.res resolution (see details).
r.mode round mode – allowed modes are "gan.floor", "floor", "ceil", "ieee.round",
"round", "mix".
i.mode type of interval center – "integer" or "half" integer.
Details
The monitored data follow a binomial distribution with size n and failure/success probability p. The
ARL values of the resulting EWMA control chart are determined by Markov chain approximation.
Here, the original EWMA values are approximated by multiples of one over d.res. Different ways
of rounding (see r.mode) to the next multiple are implemented. Besides Gan’s paper nothing is
published about the numerical subtleties.
Value
Return single value which resemble the ARL.
Author(s)
Sven Knoth
References
F. F. Gan (1990), Monitoring observations generated from a binomial distribution using modified
exponentially weighted moving average control chart, J. Stat. Comput. Simulation 37, 45-60.
S. Knoth and S. Steinmetz (2013), EWMA p charts under sampling by variables, International
Journal of Production Research 51, 3795-3807.
See Also
later.
Examples
## Gan (1990)
# Table 1
n <- 150
p0 <- .1
z0 <- n*p0
phat.ewma.arl 17
## Knoth/Steinmetz (2013)
n <- 5
p0 <- 0.02
z0 <- n*p0
lambda <- 0.3
ucl <- 0.649169922 ## in-control ARL 370.4 (determined with d.res = 2^14 = 16384)
Description
Computation of the (zero-state) Average Run Length (ARL), upper control limit (ucl) for given
in-control ARL, and lambda for minimal out-of control ARL at given shift.
Usage
phat.ewma.arl(lambda, ucl, mu, n, z0, sigma=1, type="known", LSL=-3, USL=3, N=15,
qm=25, ntype="coll")
phat.ewma.crit(lambda, L0, mu, n, z0, sigma=1, type="known", LSL=-3, USL=3, N=15, qm=25)
Arguments
lambda smoothing parameter of the EWMA control chart.
ucl upper control limit of the EWMA phat control chart.
L0 pre-defined in-control ARL (Average Run Length).
mu true mean or mean where the ARL should be minimized (then the in-control
mean is simply 0).
n subgroup size.
z0 so-called headstart (gives fast initial response).
type choose whether the standard deviation is given and fixed ("known") or estimated
and potentially monitored ("estimated").
sigma actual standard deviation of the data – the in-control value is 1.
max_l, min_l maximal and minimal value for optimal lambda search.
LSL,USL lower and upper specification limit, respectively.
N size of collocation base, dimension of the resulting linear equation system is
equal to N.
qm number of nodes for collocation quadratures.
ntype switch between the default method coll (collocation) and the classic one markov
(Markov chain approximation) for calculating the ARL numerically.
Details
The three implemented functions allow to apply a new type control chart. Basically, lower and
upper specification limits are given. The monitoring vehicle then is the empirical probability that an
item will not follow these specification given the sequence of sample means. If the related EWMA
sequence violates the control limits, then the alarm indicates a significant process deterioration. For
details see the paper mentioned in the references. To be able to construct the control charts, see the
first example.
Value
Return single values which resemble the ARL, the critical value, and the optimal lambda, respec-
tively.
Author(s)
Sven Knoth
References
S. Knoth and S. Steinmetz (2013), EWMA p charts under sampling by variables, International
Journal of Production Research 51, 3795-3807.
See Also
sewma.arl for a further collocation based ARL calculation routine.
phat.ewma.arl 19
Examples
# some functions
h.mu <- function(mu) pnorm(LSL-mu) + pnorm(mu-USL)
ewma <- function(x, lambda=0.1, z0=0) filter(lambda*x, 1-lambda, m="r", init=z0)
# parameters
LSL <- -3 # lower specification limit
USL <- 3 # upper specification limit
n <- 5 # batch size
lambda <- 0.1 # EWMA smoothing parameter
L0 <- 1000 # in-control Average Run Length (ARL)
z0 <- h.mu(0) # start at minimal defect level
ucl <- phat.ewma.crit(lambda, L0, 0, n, z0, LSL=LSL, USL=USL)
# data
x0 <- matrix(rnorm(50*n), ncol=5) # in-control data
x1 <- matrix(rnorm(50*n, mean=0.5), ncol=5)# out-of-control data
x <- rbind(x0,x1) # all data
# create chart
xbar <- apply(x, 1, mean)
phat <- h.mu(xbar)
z <- ewma(phat, lambda=lambda, z0=z0)
plot(1:length(z), z, type="l", xlab="batch", ylim=c(0,.02))
abline(h=z0, col="grey", lwd=.7)
abline(h=ucl, col="red")
# Table 1
# Table 2
# Table 3
## Not run:
mus <- c(.25, .5, 1, 2)
phat.ewma.LAMBDA <- Vectorize("phat.ewma.lambda", "mu")
lambdas <- phat.ewma.LAMBDA(L0, mus, n, p.star, LSL=LSL, USL=USL)
print(cbind(mus, lambdas))
## End(Not run)
quadrature.nodes.weights
Calculate quadrature nodes and weights
Description
Computation of the nodes and weights to enable numerical quadrature.
Usage
quadrature.nodes.weights(n, type="GL", x1=-1, x2=1)
Arguments
n number of nodes (and weights).
type quadrature type – currently Gauss-Legendre, "GL", and Radau, "Ra", are sup-
ported.
x1 lower limit of the integration interval.
x2 upper limit of the integration interval.
Details
A more detailed description will follow soon. The algorithm for the Gauss-Legendre quadrature
was delivered by Knut Petras to me, while the one for the Radau quadrature was taken from John
Burkardt.
Value
Returns two vectors which hold the needed quadrature nodes and weights.
Author(s)
Sven Knoth
scusum.arl 21
References
H. Brass and K. Petras (2011), Quadrature Theory. The Theory of Numerical Integration on a
Compact Interval, Mathematical Surveys and Monographs, American Mathematical Society.
See Also
Many of the ARL routines use the Gauss-Legendre nodes.
Examples
# GL
n <- 10
qnw <-quadrature.nodes.weights(n, type="GL")
qnw
# Radau
n <- 10
qnw <-quadrature.nodes.weights(n, type="Ra")
qnw
Description
Computation of the (zero-state) Average Run Length (ARL) for different types of CUSUM control
charts (based on the sample variance S 2 ) monitoring normal variance.
Usage
scusum.arl(k, h, sigma, df, hs=0, sided="upper", k2=NULL,
h2=NULL, hs2=0, r=40, qm=30, version=2)
Arguments
k reference value of the CUSUM control chart.
h decision interval (alarm limit, threshold) of the CUSUM control chart.
sigma true standard deviation.
df actual degrees of freedom, corresponds to subgroup size (for known mean it is
equal to the subgroup size, for unknown mean it is equal to subgroup size minus
one.
hs so-called headstart (enables fast initial response).
sided distinguishes between one- and two-sided two-sided CUSUM-S 2 control charts
by choosing "upper" (upper chart), "lower" (lower chart), and "two" (two-
sided chart), respectively. Note that for the two-sided chart the parameters "k2"
and "h2" have to be set too.
22 scusum.arl
k2 In case of a two-sided CUSUM chart for variance the reference value of the
lower chart.
h2 In case of a two-sided CUSUM chart for variance the decision interval of the
lower chart.
hs2 In case of a two-sided CUSUM chart for variance the headstart of the lower
chart.
r Dimension of the resulting linear equation system (highest order of the colloca-
tion polynomials times number of intervals – see Knoth 2006).
qm Number of quadrature nodes for calculating the collocation definite integrals.
version Distinguish version numbers (1,2,...). For internal use only.
Details
scusum.arl determines the Average Run Length (ARL) by numerically solving the related ARL
integral equation by means of collocation (piecewise Chebyshev polynomials).
Value
Returns a single value which resembles the ARL.
Author(s)
Sven Knoth
References
S. Knoth (2005), Accurate ARL computation for EWMA-S 2 control charts, Statistics and Comput-
ing 15, 341-352.
S. Knoth (2006), Computation of the ARL for CUSUM-S 2 schemes, Computational Statistics &
Data Analysis 51, 499-512.
See Also
xcusum.arl for zero-state ARL computation of CUSUM control charts for monitoring normal
mean.
Examples
## Knoth (2006)
## compare with Table 1 (p. 507)
k <- 1.46 # sigma1 = 1.5
df <- 1
h <- 10
# original values
# sigma coll63 BE Hawkins MC 10^9 (s.e.)
# 1 260.7369 260.7546 261.32 260.7399 (0.0081)
# 1.1 90.1319 90.1389 90.31 90.1319 (0.0027)
# 1.2 43.6867 43.6897 43.75 43.6845 (0.0013)
scusum.crit 23
Description
omputation of the decision intervals (alarm limits) for different types of CUSUM control charts
(based on the sample variance S 2 ) monitoring normal variance.
Usage
scusum.crit(k, L0, sigma, df, hs=0, sided="upper", mode="eq.tails",
k2=NULL, hs2=0, r=40, qm=30)
Arguments
k reference value of the CUSUM control chart.
L0 in-control ARL.
sigma true standard deviation.
df actual degrees of freedom, corresponds to subgroup size (for known mean it is
equal to the subgroup size, for unknown mean it is equal to subgroup size minus
one.
hs so-called headstart (enables fast initial response).
sided distinguishes between one- and two-sided two-sided CUSUM-S 2 control charts
by choosing "upper" (upper chart), "lower" (lower chart), and "two" (two-
sided chart), respectively. Note that for the two-sided chart the parameters "k2"
and "h2" have to be set too.
mode only deployed for sided="two" – with "eq.tails" two one-sided CUSUM
charts (lower and upper) with the same in-control ARL are coupled. With
"unbiased" a certain unbiasedness of the ARL function is guaranteed (here,
both the lower and the upper control limit are calculated).
k2 in case of a two-sided CUSUM chart for variance the reference value of the
lower chart.
hs2 in case of a two-sided CUSUM chart for variance the headstart of the lower
chart.
24 scusums.arl
r Dimension of the resulting linear equation system (highest order of the colloca-
tion polynomials times number of intervals – see Knoth 2006).
qm Number of quadrature nodes for calculating the collocation definite integrals.
Details
scusum.crit ddetermines the decision interval (alarm limit) for given in-control ARL L0 by ap-
plying secant rule and using scusum.arl().
Value
Returns a single value which resembles the decision interval h.
Author(s)
Sven Knoth
References
S. Knoth (2005), Accurate ARL computation for EWMA-S 2 control charts, Statistics and Comput-
ing 15, 341-352.
S. Knoth (2006), Computation of the ARL for CUSUM-S 2 schemes, Computational Statistics &
Data Analysis 51, 499-512.
See Also
xcusum.arl for zero-state ARL computation of CUSUM control charts monitoring normal mean.
Examples
## Knoth (2006)
## compare with Table 1 (p. 507)
k <- 1.46 # sigma1 = 1.5
df <- 1
L0 <- 260.74
h <- scusum.crit(k, L0, 1, df)
h
# original value is 10
Description
Computation of the (zero-state) Average Run Length (ARL) for different types of CUSUM-Shewhart
combo control charts (based on the sample variance S 2 ) monitoring normal variance.
scusums.arl 25
Usage
scusums.arl(k, h, cS, sigma, df, hs=0, sided="upper", k2=NULL,
h2=NULL, hs2=0, r=40, qm=30, version=2)
Arguments
k reference value of the CUSUM control chart.
h decision interval (alarm limit, threshold) of the CUSUM control chart.
cS Shewhart limit.
sigma true standard deviation.
df actual degrees of freedom, corresponds to subgroup size (for known mean it is
equal to the subgroup size, for unknown mean it is equal to subgroup size minus
one.
hs so-called headstart (enables fast initial response).
sided distinguishes between one- and two-sided two-sided CUSUM-S 2 control charts
by choosing "upper" (upper chart), "lower" (lower chart), and "two" (two-
sided chart), respectively. Note that for the two-sided chart the parameters "k2"
and "h2" have to be set too.
k2 In case of a two-sided CUSUM chart for variance the reference value of the
lower chart.
h2 In case of a two-sided CUSUM chart for variance the decision interval of the
lower chart.
hs2 In case of a two-sided CUSUM chart for variance the headstart of the lower
chart.
r Dimension of the resulting linear equation system (highest order of the colloca-
tion polynomials times number of intervals – see Knoth 2006).
qm Number of quadrature nodes for calculating the collocation definite integrals.
version Distinguish version numbers (1,2,...). For internal use only.
Details
scusums.arl determines the Average Run Length (ARL) by numerically solving the related ARL
integral equation by means of collocation (piecewise Chebyshev polynomials).
Value
Returns a single value which resembles the ARL.
Author(s)
Sven Knoth
References
S. Knoth (2006), Computation of the ARL for CUSUM-S 2 schemes, Computational Statistics &
Data Analysis 51, 499-512.
26 sewma.arl
See Also
scusum.arl for zero-state ARL computation of standalone CUSUM control charts for monitoring
normal variance.
Examples
## will follow
Description
Computation of the (zero-state) Average Run Length (ARL) for different types of EWMA control
charts (based on the sample variance S 2 ) monitoring normal variance.
Usage
sewma.arl(l,cl,cu,sigma,df,s2.on=TRUE,hs=NULL,sided="upper",r=40,qm=30)
Arguments
l smoothing parameter lambda of the EWMA control chart.
cl lower control limit of the EWMA control chart.
cu upper control limit of the EWMA control chart.
sigma true standard deviation.
df actual degrees of freedom, corresponds to subgroup size (for known mean it is
equal to the subgroup size, for unknown mean it is equal to subgroup size minus
one.
s2.on distinguishes between S 2 and S chart.
hs so-called headstart (enables fast initial response); the default (NULL) yields the
expected in-control value of S 2 (1) and S (c4 ), respectively.
sided distinguishes between one- and two-sided two-sided EWMA-S 2 control charts
by choosing "upper" (upper chart without reflection at cl – the actual value of
cl is not used), "Rupper" (upper chart with reflection at cl), "Rlower" (lower
chart with reflection at cu), and "two" (two-sided chart), respectively.
r dimension of the resulting linear equation system (highest order of the colloca-
tion polynomials).
qm number of quadrature nodes for calculating the collocation definite integrals.
Details
sewma.arl determines the Average Run Length (ARL) by numerically solving the related ARL
integral equation by means of collocation (Chebyshev polynomials).
sewma.arl 27
Value
Returns a single value which resembles the ARL.
Author(s)
Sven Knoth
References
S. Knoth (2005), Accurate ARL computation for EWMA-S 2 control charts, Statistics and Comput-
ing 15, 341-352.
S. Knoth (2006), Computation of the ARL for CUSUM-S 2 schemes, Computational Statistics &
Data Analysis 51, 499-512.
See Also
xewma.arl for zero-state ARL computation of EWMA control charts for monitoring normal mean.
Examples
## Knoth (2005)
## compare with Table 1 (p. 347): 249.9997
## Monte Carlo with 10^9 replicates: 249.9892 +/- 0.008
l <- .025
df <- 1
cu <- 1 + 1.661865*sqrt(l/(2-l))*sqrt(2/df)
sewma.arl(l,0,cu,1,df)
## ARL values for upper and lower EWMA charts with reflecting barriers
## (reflection at in-control level sigma0 = 1)
## examples from Knoth (2006), Tables 4 and 5
## Not run:
28 sewma.arl.prerun
l <- 0.15
df <- 4
cu <- 1 + 2.4831*sqrt(l/(2-l))*sqrt(2/df)
sigmas <- c(1 + (0:5)/100, 1 + (1:5)/10, 2)
arls <- round(Ssewma.arl(l, 1, cu, sigmas, df, sided="Rupper", r=100), digits=2)
data.frame(sigmas, arls)
## End(Not run)
## Not run:
l <- 0.115
df <- 5
cl <- 1 - 2.0613*sqrt(l/(2-l))*sqrt(2/df)
sigmas <- c((10:6)/10)
arls <- round(Ssewma.arl(l, cl, 1, sigmas, df, sided="Rlower", r=100), digits=2)
data.frame(sigmas, arls)
## End(Not run)
Description
Computation of the (zero-state) Average Run Length (ARL) for EWMA control charts (based on
the sample variance S 2 ) monitoring normal variance with estimated parameters.
Usage
sewma.arl.prerun(l, cl, cu, sigma, df1, df2, hs=1, sided="upper",
r=40, qm=30, qm.sigma=30, truncate=1e-10)
Arguments
l smoothing parameter lambda of the EWMA control chart.
cl lower control limit of the EWMA control chart.
cu upper control limit of the EWMA control chart.
sigma true standard deviation.
df1 actual degrees of freedom, corresponds to subgroup size (for known mean it is
equal to the subgroup size, for unknown mean it is equal to subgroup size minus
one.
sewma.arl.prerun 29
Details
Essentially, the ARL function sewma.arl is convoluted with the distribution of the sample standard
deviation. For details see Jones/Champ/Rigdon (2001) and Knoth (2014?).
Value
Author(s)
Sven Knoth
References
See Also
sewma.arl for zero-state ARL function of EWMA control charts w/o pre run uncertainty.
Examples
## Knoth (2014?)
30 sewma.crit
Description
Computation of the critical values (similar to alarm limits) for different types of EWMA control
charts (based on the sample variance S 2 ) monitoring normal variance.
Usage
sewma.crit(l,L0,df,sigma0=1,cl=NULL,cu=NULL,hs=NULL,s2.on=TRUE,
sided="upper",mode="fixed",ur=4,r=40,qm=30)
Arguments
l smoothing parameter lambda of the EWMA control chart.
L0 in-control ARL.
df actual degrees of freedom, corresponds to subgroup size (for known mean it is
equal to the subgroup size, for unknown mean it is equal to subgroup size minus
one.
sigma0 in-control standard deviation.
cl deployed for sided="Rupper", that is, upper variance control chart with lower
reflecting barrier cl.
cu for two-sided (sided="two") and fixed upper control limit (mode="fixed") a
value larger than sigma0 has to been given, for all other cases cu is ignored.
hs so-called headstart (enables fast initial response); the default (NULL) yields the
expected in-control value of S 2 (1) and S (c4 ), respectively.
s2.on distinguishes between S 2 and S chart.
sided distinguishes between one- and two-sided two-sided EWMA-S 2 control charts
by choosing "upper" (upper chart without reflection at cl – the actual value of
cl is not used), "Rupper" (upper chart with reflection at cl), "Rlower" (lower
chart with reflection at cu), and "two" (two-sided chart), respectively.
mode only deployed for sided="two" – with "fixed" an upper control limit (see cu)
is set and only the lower is calculated to obtain the in-control ARL L0, while with
"unbiased" a certain unbiasedness of the ARL function is guaranteed (here,
both the lower and the upper control limit are calculated). With "vanilla"
limits symmetric around 1 (the in-control value of the variance) are determined,
while for "eq.tails" the in-control ARL values of two single EWMA variance
charts (decompose the two-sided scheme into one lower and one upper scheme)
are matched.
ur truncation of lower chart for eq.tails mode.
r dimension of the resulting linear equation system (highest order of the colloca-
tion polynomials).
qm number of quadrature nodes for calculating the collocation definite integrals.
sewma.crit 31
Details
sewma.crit determines the critical values (similar to alarm limits) for given in-control ARL L0 by
applying secant rule and using sewma.arl(). In case of sided="two" and mode="unbiased" a
two-dimensional secant rule is applied that also ensures that the maximum of the ARL function for
given standard deviation is attained at sigma0. See Knoth (2010) and the related example.
Value
Returns the lower and upper control limit cl and cu.
Author(s)
Sven Knoth
References
H.-J. Mittag and D. Stemann and B. Tewes (1998), EWMA-Karten zur \"Uberwachung der Streuung
von Qualit\"atsmerkmalen, Allgemeines Statistisches Archiv 82, 327-338,
C. A. Acosta-Mej\’ia and J. J. Pignatiello Jr. and B. V. Rao (1999), A comparison of control charting
procedures for monitoring process dispersion, IIE Transactions 31, 569-579.
S. Knoth (2005), Accurate ARL computation for EWMA-S 2 control charts, Statistics and Comput-
ing 15, 341-352.
S. Knoth (2006a), Computation of the ARL for CUSUM-S 2 schemes, Computational Statistics &
Data Analysis 51, 499-512.
S. Knoth (2006b), The art of evaluating monitoring schemes – how to measure the performance of
control charts? in Frontiers in Statistical Quality Control 8, H.-J. Lenz and P.-T. Wilrich (Eds.),
Physica Verlag, Heidelberg, Germany, 74-99.
S. Knoth (2010), Control Charting Normal Variance – Reflections, Curiosities, and Recommen-
dations, in Frontiers in Statistical Quality Control 9, H.-J. Lenz and P.-T. Wilrich (Eds.), Physica
Verlag, Heidelberg, Germany, 3-18.
See Also
sewma.arl for calculation of ARL of variance charts.
Examples
## Mittag et al. (1998)
## compare their upper critical value 2.91 that
## leads to the upper control limit via the formula shown below
## (for the usual upper EWMA \eqn{S^2}{S^2}).
## See Knoth (2006b) for a discussion of this EWMA setup and it's evaluation.
l <- 0.18
L0 <- 250
df <- 4
limits <- sewma.crit(l, L0, df)
limits["cu"]
32 sewma.crit
## Knoth (2005)
## reproduce the critical value given in Figure 2 (c=1.661865) for
## upper EWMA \eqn{S^2}{S^2} with df=1
l <- 0.025
L0 <- 250
df <- 1
limits <- sewma.crit(l, L0, df)
cv.Fig2 <- (limits["cu"]-1)/( sqrt(l/(2-l))*sqrt(2/df) )
cv.Fig2
## the small difference (sixth digit after decimal point) stems from
## tighter criterion in the secant rule implemented in the R package.
## Not run:
l <- 0.1
L0 <- 500
df <- 4
limits <- sewma.crit(l, L0, df, sided="two", mode="unbiased", r=80)
SEWMA.arl <- Vectorize(sewma.arl, "sigma")
SEWMA.ARL <- function(sigma)
SEWMA.arl(l, limits[1], limits[2], sigma, df, sided="two", r=80)
layout(matrix(1:2, nrow=1))
curve(SEWMA.ARL, .75, 1.25, log="y")
curve(SEWMA.ARL, .95, 1.05, log="y")
## End(Not run)
# the above stuff needs about 1 minute
## control limits for upper and lower EWMA charts with reflecting barriers
## (reflection at in-control level sigma0 = 1)
## examples from Knoth (2006a), Tables 4 and 5
## Not run:
## upper chart with reflection at sigma0=1 in Table 4: c = 2.4831
l <- 0.15
L0 <- 100
df <- 4
limits <- sewma.crit(l, L0, df, cl=1, sided="Rupper", r=100)
cv.Tab4 <- (limits["cu"]-1)/( sqrt(l/(2-l))*sqrt(2/df) )
cv.Tab4
df <- 5
limits <- sewma.crit(l, L0, df, cu=1, sided="Rlower", r=100)
cv.Tab5 <- -(limits["cl"]-1)/( sqrt(l/(2-l))*sqrt(2/df) )
cv.Tab5
## End(Not run)
Description
Computation of quantiles of the Run Length (RL) for EWMA control charts monitoring normal
variance.
Usage
sewma.crit.prerun(l,L0,df1,df2,sigma0=1,cl=NULL,cu=NULL,hs=1,sided="upper",
mode="fixed",r=40,qm=30,qm.sigma=30,truncate=1e-10,
tail_approx=TRUE,c.error=1e-10,a.error=1e-9)
Arguments
l smoothing parameter lambda of the EWMA control chart.
L0 in-control quantile value.
df1 actual degrees of freedom, corresponds to subgroup size (for known mean it is
equal to the subgroup size, for unknown mean it is equal to subgroup size minus
one.
df2 degrees of freedom of the pre-run variance estimator.
sigma,sigma0 true and in-control standard deviation, respectively.
cl deployed for sided="Rupper", that is, upper variance control chart with lower
reflecting barrier cl.
cu for two-sided (sided="two") and fixed upper control limit (mode="fixed") a
value larger than sigma0 has to been given, for all other cases cu is ignored.
hs so-called headstart (enables fast initial response).
sided distinguishes between one- and two-sided two-sided EWMA-S 2 control charts
by choosing "upper" (upper chart without reflection at cl – the actual value of
cl is not used), "Rupper" (upper chart with reflection at cl), "Rlower" (lower
chart with reflection at cu),and "two" (two-sided chart), respectively.
mode only deployed for sided="two" – with "fixed" an upper control limit (see cu)
is set and only the lower is calculated to obtain the in-control ARL L0, while with
"unbiased" a certain unbiasedness of the ARL function is guaranteed (here,
both the lower and the upper control limit are calculated).
r dimension of the resulting linear equation system (highest order of the colloca-
tion polynomials).
34 sewma.crit.prerun
Details
sewma.crit.prerun determines the critical values (similar to alarm limits) for given in-control
ARL L0 by applying secant rule and using sewma.arl.prerun(). In case of sided="two" and
mode="unbiased" a two-dimensional secant rule is applied that also ensures that the maximum of
the ARL function for given standard deviation is attained at sigma0. See Knoth (2010) for some
details of the algorithm involved.
Value
Author(s)
Sven Knoth
References
H.-J. Mittag and D. Stemann and B. Tewes (1998), EWMA-Karten zur \"Uberwachung der Streu-
ung von Qualit\"atsmerkmalen, Allgemeines Statistisches Archiv 82, 327-338, S. Knoth (2005),
Accurate ARL computation for EWMA-S 2 control charts, Statistics and Computing 15, 341-352.
S. Knoth (2010), Control Charting Normal Variance – Reflections, Curiosities, and Recommen-
dations, in Frontiers in Statistical Quality Control 9, H.-J. Lenz and P.-T. Wilrich (Eds.), Physica
Verlag, Heidelberg, Germany, 3-18.
See Also
sewma.arl.prerun for calculation of ARL of variance charts under pre-run uncertainty and sewma.crit
for the algorithm w/o pre-run uncertainty.
Examples
## Knoth (2014?)
sewma.q 35
Description
Computation of quantiles of the Run Length (RL) for EWMA control charts monitoring normal
variance.
Usage
sewma.q(l, cl, cu, sigma, df, alpha, hs=1, sided="upper", r=40, qm=30)
sewma.q.crit(l,L0,alpha,df,sigma0=1,cl=NULL,cu=NULL,hs=1,sided="upper",
mode="fixed",ur=4,r=40,qm=30,c.error=1e-12,a.error=1e-9)
Arguments
l smoothing parameter lambda of the EWMA control chart.
cl deployed for sided="Rupper", that is, upper variance control chart with lower
reflecting barrier cl.
cu for two-sided (sided="two") and fixed upper control limit (mode="fixed") a
value larger than sigma0 has to been given, for all other cases cu is ignored.
sigma,sigma0 true and in-control standard deviation, respectively.
df actual degrees of freedom, corresponds to subgroup size (for known mean it is
equal to the subgroup size, for unknown mean it is equal to subgroup size minus
one.
alpha quantile level.
hs so-called headstart (enables fast initial response).
sided distinguishes between one- and two-sided two-sided EWMA-S 2 control charts
by choosing "upper" (upper chart without reflection at cl – the actual value of
cl is not used), "Rupper" (upper chart with reflection at cl), "Rlower" (lower
chart with reflection at cu),and "two" (two-sided chart), respectively.
mode only deployed for sided="two" – with "fixed" an upper control limit (see cu)
is set and only the lower is calculated to obtain the in-control ARL L0, while with
"unbiased" a certain unbiasedness of the ARL function is guaranteed (here,
both the lower and the upper control limit are calculated).
ur truncation of lower chart for classic mode.
r dimension of the resulting linear equation system (highest order of the colloca-
tion polynomials).
qm number of quadrature nodes for calculating the collocation definite integrals.
L0 in-control quantile value.
c.error error bound for two succeeding values of the critical value during applying the
secant rule.
a.error error bound for the quantile level alpha during applying the secant rule.
36 sewma.q
Details
Instead of the popular ARL (Average Run Length) quantiles of the EWMA stopping time (Run
Length) are determined. The algorithm is based on Waldmann’s survival function iteration proce-
dure. Thereby the ideas presented in Knoth (2007) are used. sewma.q.crit determines the critical
values (similar to alarm limits) for given in-control RL quantile L0 at level alpha by applying secant
rule and using sewma.sf(). In case of sided="two" and mode="unbiased" a two-dimensional se-
cant rule is applied that also ensures that the minimum of the cdf for given standard deviation is
attained at sigma0.
Value
Returns a single value which resembles the RL quantile of order alpha and the lower and upper
control limit cl and cu, respectively.
Author(s)
Sven Knoth
References
H.-J. Mittag and D. Stemann and B. Tewes (1998), EWMA-Karten zur \"Uberwachung der Streuung
von Qualit\"atsmerkmalen, Allgemeines Statistisches Archiv 82, 327-338,
C. A. Acosta-Mej\’ia and J. J. Pignatiello Jr. and B. V. Rao (1999), A comparison of control charting
procedures for monitoring process dispersion, IIE Transactions 31, 569-579.
S. Knoth (2005), Accurate ARL computation for EWMA-S 2 control charts, Statistics and Comput-
ing 15, 341-352.
S. Knoth (2007), Accurate ARL calculation for EWMA control charts monitoring simultaneously
normal mean and variance, Sequential Analysis 26, 251-264.
S. Knoth (2010), Control Charting Normal Variance – Reflections, Curiosities, and Recommen-
dations, in Frontiers in Statistical Quality Control 9, H.-J. Lenz and P.-T. Wilrich (Eds.), Physica
Verlag, Heidelberg, Germany, 3-18.
K.-H. Waldmann (1986), Bounds for the distribution of the run length of geometric moving average
charts, Appl. Statist. 35, 151-158.
See Also
sewma.arl for calculation of ARL of variance charts and sewma.sf for the RL survival function.
Examples
## Knoth (2014?)
sewma.q.prerun 37
Description
Computation of quantiles of the Run Length (RL) for EWMA control charts monitoring normal
variance.
Usage
sewma.q.prerun(l,cl,cu,sigma,df1,df2,alpha,hs=1,sided="upper",
r=40,qm=30,qm.sigma=30,truncate=1e-10)
sewma.q.crit.prerun(l,L0,alpha,df1,df2,sigma0=1,cl=NULL,cu=NULL,hs=1,
sided="upper",mode="fixed",r=40, qm=30,qm.sigma=30,truncate=1e-10,
tail_approx=TRUE,c.error=1e-10,a.error=1e-9)
Arguments
l smoothing parameter lambda of the EWMA control chart.
cl deployed for sided="Rupper", that is, upper variance control chart with lower
reflecting barrier cl.
cu for two-sided (sided="two") and fixed upper control limit (mode="fixed") a
value larger than sigma0 has to been given, for all other cases cu is ignored.
sigma,sigma0 true and in-control standard deviation, respectively.
L0 in-control quantile value.
alpha quantile level.
df1 actual degrees of freedom, corresponds to subgroup size (for known mean it is
equal to the subgroup size, for unknown mean it is equal to subgroup size minus
one.
df2 degrees of freedom of the pre-run variance estimator.
hs so-called headstart (enables fast initial response).
sided distinguishes between one- and two-sided two-sided EWMA-S 2 control charts
by choosing "upper" (upper chart without reflection at cl – the actual value of
cl is not used), "Rupper" (upper chart with reflection at cl), "Rlower" (lower
chart with reflection at cu), and "two" (two-sided chart), respectively.
mode only deployed for sided="two" – with "fixed" an upper control limit (see cu)
is set and only the lower is calculated to obtain the in-control ARL L0, while with
"unbiased" a certain unbiasedness of the ARL function is guaranteed (here,
both the lower and the upper control limit are calculated).
r dimension of the resulting linear equation system (highest order of the colloca-
tion polynomials).
38 sewma.q.prerun
Details
Instead of the popular ARL (Average Run Length) quantiles of the EWMA stopping time (Run
Length) are determined. The algorithm is based on Waldmann’s survival function iteration proce-
dure. Thereby the ideas presented in Knoth (2007) are used. sewma.q.crit.prerun determines
the critical values (similar to alarm limits) for given in-control RL quantile L0 at level alpha by
applying secant rule and using sewma.sf(). In case of sided="two" and mode="unbiased" a
two-dimensional secant rule is applied that also ensures that the minimum of the cdf for given
standard deviation is attained at sigma0.
Value
Returns a single value which resembles the RL quantile of order alpha and the lower and upper
control limit cl and cu, respectively.
Author(s)
Sven Knoth
References
S. Knoth (2007), Accurate ARL calculation for EWMA control charts monitoring simultaneously
normal mean and variance, Sequential Analysis 26, 251-264.
K.-H. Waldmann (1986), Bounds for the distribution of the run length of geometric moving average
charts, Appl. Statist. 35, 151-158.
See Also
Examples
## Knoth (2014?)
sewma.sf 39
Description
Computation of the survival function of the Run Length (RL) for EWMA control charts monitoring
normal variance.
Usage
sewma.sf(n, l, cl, cu, sigma, df, hs=1, sided="upper", r=40, qm=30)
Arguments
n calculate sf up to value n.
l smoothing parameter lambda of the EWMA control chart.
cl lower control limit of the EWMA control chart.
cu upper control limit of the EWMA control chart.
sigma true standard deviation.
df actual degrees of freedom, corresponds to subgroup size (for known mean it is
equal to the subgroup size, for unknown mean it is equal to subgroup size minus
one.
hs so-called headstart (enables fast initial response).
sided distinguishes between one- and two-sided two-sided EWMA-S 2 control charts
by choosing "upper" (upper chart without reflection at cl – the actual value of
cl is not used), "Rupper" (upper chart with reflection at cl), "Rlower" (lower
chart with reflection at cu), and "two" (two-sided chart), respectively.
r dimension of the resulting linear equation system (highest order of the colloca-
tion polynomials).
qm number of quadrature nodes for calculating the collocation definite integrals.
Details
The survival function P(L>n) and derived from it also the cdf P(L<=n) and the pmf P(L=n) illustrate
the distribution of the EWMA run length. For large n the geometric tail could be exploited. That
is, with reasonable large n the complete distribution is characterized. The algorithm is based on
Waldmann’s survival function iteration procedure and on results in Knoth (2007).
Value
Returns a vector which resembles the survival function up to a certain point.
Author(s)
Sven Knoth
40 sewma.sf.prerun
References
S. Knoth (2007), Accurate ARL calculation for EWMA control charts monitoring simultaneously
normal mean and variance, Sequential Analysis 26, 251-264.
K.-H. Waldmann (1986), Bounds for the distribution of the run length of geometric moving average
charts, Appl. Statist. 35, 151-158.
See Also
sewma.arl for zero-state ARL computation of variance EWMA control charts.
Examples
## Knoth (2014?)
Description
Computation of the survival function of the Run Length (RL) for EWMA control charts monitoring
normal variance.
Usage
sewma.sf.prerun(n, l, cl, cu, sigma, df1, df2, hs=1, sided="upper",
qm=30, qm.sigma=30, truncate=1e-10, tail_approx=TRUE)
Arguments
n calculate sf up to value n.
l smoothing parameter lambda of the EWMA control chart.
cl lower control limit of the EWMA control chart.
cu upper control limit of the EWMA control chart.
sigma true standard deviation.
df1 actual degrees of freedom, corresponds to subgroup size (for known mean it is
equal to the subgroup size, for unknown mean it is equal to subgroup size minus
one.
df2 degrees of freedom of the pre-run variance estimator.
hs so-called headstart (enables fast initial response).
sided distinguishes between one- and two-sided two-sided EWMA-S 2 control charts
by choosing "upper" (upper chart without reflection at cl – the actual value of
cl is not used), "Rupper" (upper chart with reflection at cl), "Rlower" (lower
chart with reflection at cu), and "two" (two-sided chart), respectively.
qm number of quadrature nodes for calculating the collocation definite integrals.
tol.lim.fac 41
qm.sigma number of quadrature nodes for convoluting the standard deviation uncertainty.
truncate size of truncated tail.
tail_approx Controls whether the geometric tail approximation is used (is faster) or not.
Details
The survival function P(L>n) and derived from it also the cdf P(L<=n) and the pmf P(L=n) illustrate
the distribution of the EWMA run length. For large n the geometric tail could be exploited. That
is, with reasonable large n the complete distribution is characterized. The algorithm is based on
Waldmann’s survival function iteration procedure and on results in Knoth (2007)...
Value
Returns a vector which resembles the survival function up to a certain point.
Author(s)
Sven Knoth
References
S. Knoth (2007), Accurate ARL calculation for EWMA control charts monitoring simultaneously
normal mean and variance, Sequential Analysis 26, 251-264.
K.-H. Waldmann (1986), Bounds for the distribution of the run length of geometric moving average
charts, Appl. Statist. 35, 151-158.
See Also
sewma.sf for the RL survival function of EWMA control charts w/o pre-run uncertainty.
Examples
## Knoth (2014?)
Description
For constructing tolerance intervals, which cover a given proportion p of a normal distribution with
unknown mean and variance with confidence 1 − α, one needs to calculate the so-called tolerance
limit factors k. These values are computed for a given sample size n.
Usage
tol.lim.fac(n,p,a,mode="WW",m=30)
42 tol.lim.fac
Arguments
n sample size.
p coverage.
a error probability α, resulting interval covers at least proportion p with confi-
dence of at least 1 − α.
mode distinguish between Wald/Wolfowitz’ approximation method ("WW") and the
more accurate approach ("exact") based on Gauss-Legendre quadrature.
m number of abscissas for the quadrature (needed only for method="exact"), of
course, the larger the more accurate.
Details
tol.lim.fac determines tolerance limits factors k by means of the fast and simple approximation
due to Wald/Wolfowitz (1946) and of Gauss-Legendre quadrature like Odeh/Owen (1980), respec-
tively, who used in fact the Simpson Rule. Then, by x̄ ± k · s one can build the tolerance intervals
which cover at least proportion p of a normal distribution for given confidence level of 1 − α. x̄ and
s stand for the sample mean and the sample standard deviation, respectively.
Value
Returns a single value which resembles the tolerance limit factor.
Author(s)
Sven Knoth
References
A. Wald, J. Wolfowitz (1946), Tolerance limits for a normal distribution, Annals of Mathematical
Statistics 17, 208-215.
R. E. Odeh, D. B. Owen (1980), Tables for Normal Tolerance Limits, Sampling Plans, and Screen-
ing, Marcel Dekker, New York.
See Also
qnorm for the ”asymptotic” case – cf. second example.
Examples
n <- 2:10
p <- .95
a <- .05
kWW <- sapply(n,p=p,a=a,tol.lim.fac)
kEX <- sapply(n,p=p,a=a,mode="exact",tol.lim.fac)
print(cbind(n,kWW,kEX),digits=4)
## Odeh/Owen (1980), page 98, in Table 3.4.1
## n factor k
## 2 36.519
x.res.ewma.arl 43
## 3 9.789
## 4 6.341
## 5 5.077
## 6 4.422
## 7 4.020
## 8 3.746
## 9 3.546
## 10 3.393
## n -> infty
n <- 10^{1:7}
p <- .95
a <- .05
kEX <- round(sapply(n,p=p,a=a,mode="exact",tol.lim.fac),digits=4)
kEXinf <- round(qnorm(1-a/2),digits=4)
print(rbind(cbind(n,kEX),c("infinity",kEXinf)),quote=FALSE)
Description
Computation of the (zero-state) Average Run Length (ARL) for EWMA residual control charts
monitoring normal mean, variance, or mean and variance simultaneously. Additionally, the proba-
bility of misleading signals (PMS) is calculated.
Usage
x.res.ewma.arl(l, c, mu, alpha=0, n=5, hs=0, r=40)
Arguments
l, lx, ls smoothing parameter(s) lambda of the EWMA control chart.
c, cu, cx, csu critical value (similar to alarm limit) of the EWMA control charts.
mu true mean.
sigma true standard deviation.
alpha the AR(1) coefficient – first order autocorrelation of the original data.
n batch size.
hs, hsx, hss so-called headstart (enables fast initial response).
44 x.res.ewma.arl
r, rx, rs number of quadrature nodes or size of collocation base, dimension of the result-
ing linear equation system is equal to r (two-sided).
qm number of nodes for collocation quadratures.
type PMS type, for PMS="3" (the default) the probability of getting a mean signal
despite the variance changed, and for PMS="4" the opposite case is dealt with.
Details
The above list of functions provides the application of algorithms developed for iid data to the
residual case. To be more precise, the underlying model is a sequence of normally distributed
batches with size n with autocorrelation within the batch and independence between the batches
(see also the references below). It is restricted to the classical EWMA chart types, that is two-sided
for the mean, upper charts for the variance, and all equipped with fixed limits. The autocorrelation
is modeled by an AR(1) process with parameter alpha. Additionally, with xs.res.ewma.pms the
probability of misleading signals (PMS) of type is calculated. This is offered exclusively in this
small collection so that for iid data this function has to be used too (with alpha=0).
Value
Return single values which resemble the ARL and the PMS, respectively.
Author(s)
Sven Knoth
References
S. Knoth, M. C. Morais, A. Pacheco, W. Schmid (2009), Misleading Signals in Simultaneous Resid-
ual Schemes for the Mean and Variance of a Stationary Process, Commun. Stat., Theory Methods
38, 2923-2943.
S. Knoth, W. Schmid, A. Schoene (2001), Simultaneous Shewhart-Type Charts for the Mean and
the Variance of a Time Series, Frontiers of Statistical Quality Control 6, A. Lenz, H.-J. & Wilrich,
P.-T. (Eds.), 6, 61-79.
S. Knoth, W. Schmid (2002) Monitoring the mean and the variance of a stationary process, Statistica
Neerlandica 56, 77-100.
See Also
xewma.arl, sewma.arl, and xsewma.arl as more elaborated functions in the iid case.
Examples
## Not run:
## S. Knoth, W. Schmid (2002)
n <- 5
print(crit)
lambda <- .1
# the algorithm used in Knoth/Schmid is less accurate -- proceed with their values
cx <- x.e <- 3.0578
s.e <- 3.3376
csu <- 1 + s.e * sqrt(lambda/(2-lambda))*sqrt(2/(n-1))
alpha <- .3
print(arls)
pms <- c(pms, round(xs.res.ewma.pms(lambda, cx, lambda, csu, mu, 1, type="4", alpha=alpha, n=n),
digits=6))
}
PMS.4 <- rbind(PMS.4, data.frame(delta=deltas[ir], t(pms)))
}
names(PMS.4) <- c("delta", alphas)
rownames(PMS.4) <- NULL
print(PMS.4)
## End(Not run)
Description
Computation of the steady-state Average Run Length (ARL) for different types of CUSUM control
charts monitoring normal mean.
Usage
xcusum.ad(k, h, mu1, mu0 = 0, sided = "one", r = 30)
Arguments
k reference value of the CUSUM control chart.
h decision interval (alarm limit, threshold) of the CUSUM control chart.
mu1 out-of-control mean.
mu0 in-control mean.
sided distinguish between one-, two-sided and Crosier’s modified two-sided CUSUM
scheme by choosing "one", "two", and "Crosier", respectively.
r number of quadrature nodes, dimension of the resulting linear equation system
is equal to r+1 (one-, two-sided) or 2r+1 (Crosier).
48 xcusum.ad
Details
xcusum.ad determines the steady-state Average Run Length (ARL) by numerically solving the
related ARL integral equation by means of the Nystroem method based on Gauss-Legendre quadra-
ture and using the power method for deriving the largest in magnitude eigenvalue and the related
left eigenfunction.
Value
Returns a single value which resembles the steady-state ARL.
Note
Be cautious in increasing the dimension parameter r for two-sided CUSUM schemes. The resulting
matrix dimension is r^2 times r^2. Thus, go beyond 30 only on fast machines. This is the only
case, were the package routines are based on the Markov chain approach. Moreover, the two-sided
CUSUM scheme needs a two-dimensional Markov chain.
Author(s)
Sven Knoth
References
R. B. Crosier (1986), A new two-sided cumulative quality control scheme, Technometrics 28, 187-
194.
See Also
xcusum.arl for zero-state ARL computation and xewma.ad for the steady-state ARL of EWMA
control charts.
Examples
## comparison of zero-state (= worst case ) and steady-state performance
## for one-sided CUSUM control charts
k <- .5
h <- xcusum.crit(k,500)
mu <- c(0,.5,1,1.5,2)
arl <- sapply(mu,k=k,h=h,xcusum.arl)
ad <- sapply(mu,k=k,h=h,xcusum.ad)
round(cbind(mu,arl,ad),digits=2)
k <- .5
h2 <- 4
hC <- 3.73
mu <- c(0,.25,.5,.75,1,1.5,2,2.5,3,4,5)
xcusum.arl 49
Description
Computation of the (zero-state) Average Run Length (ARL) for different types of CUSUM control
charts monitoring normal mean.
Usage
xcusum.arl(k, h, mu, hs = 0, sided = "one", method = "igl", q = 1, r = 30)
Arguments
k reference value of the CUSUM control chart.
h decision interval (alarm limit, threshold) of the CUSUM control chart.
mu true mean.
hs so-called headstart (give fast initial response).
sided distinguish between one-, two-sided and Crosier’s modified two-sided CUSUM
scheme by choosing "one", "two", and "Crosier", respectively.
method deploy the integral equation ("igl") or Markov chain approximation ("mc")
method to calculate the ARL (currently only for two-sided CUSUM imple-
mented).
q change point position. For q = 1 and µ = µ0 and µ = µ1 , the usual zero-state
ARLs for the in-control and out-of-control case, respectively, are calculated. For
q > 1 and µ! = 0 conditional delays, that is, Eq (L − q + 1|L ≥ q), will be
determined. Note that mu0=0 is implicitely fixed.
r number of quadrature nodes, dimension of the resulting linear equation system
is equal to r+1 (one-, two-sided) or 2r+1 (Crosier).
50 xcusum.arl
Details
xcusum.arl determines the Average Run Length (ARL) by numerically solving the related ARL
integral equation by means of the Nystroem method based on Gauss-Legendre quadrature.
Value
Returns a vector of length q which resembles the ARL and the sequence of conditional expected
delays for q=1 and q>1, respectively.
Author(s)
Sven Knoth
References
A. L. Goel, S. M. Wu (1971), Determination of A.R.L. and a contour nomogram for CUSUM charts
to control normal mean, Technometrics 13, 221-230.
D. Brook, D. A. Evans (1972), An approach to the probability distribution of cusum run length,
Biometrika 59, 539-548.
J. M. Lucas, R. B. Crosier (1982), Fast initial response for cusum quality-control schemes: Give
your cusum a headstart, Technometrics 24, 199-205.
L. C. Vance (1986), Average run lengths of cumulative sum control charts for controlling normal
means, Journal of Quality Technology 18, 189-193.
K.-H. Waldmann (1986), Bounds for the distribution of the run length of one-sided and two-sided
CUSUM quality control schemes, Technometrics 28, 61-67.
R. B. Crosier (1986), A new two-sided cumulative quality control scheme, Technometrics 28, 187-
194.
See Also
xewma.arl for zero-state ARL computation of EWMA control charts and xcusum.ad for the steady-
state ARL.
Examples
## Brook/Evans (1972), one-sided CUSUM
## Their results are based on the less accurate Markov chain approach.
k <- .5
h <- 3
round(c( xcusum.arl(k,h,0), xcusum.arl(k,h,1.5) ),digits=2)
## results in the original paper are L0 = 117.59, L1 = 3.75 (in Subsection 4.3).
k <- .5
h <- 4
xcusum.arl 51
mu <- c(0,.25,.5,.75,1,1.5,2,2.5,3,4,5)
arl1 <- sapply(mu,k=k,h=h,sided="two",xcusum.arl)
arl2 <- sapply(mu,k=k,h=h,hs=h/2,sided="two",xcusum.arl)
round(cbind(mu,arl1,arl2),digits=2)
k <- 0
h <- 10
mu <- c(-.25,-.125,0,.125,.25,.5,.75,1)
round(cbind(mu,sapply(mu,k=k,h=h,xcusum.arl)),digits=2)
## results in the original paper are (in Table 1 incl. Goel/Wu (1971) results)
## -0.25 2071.51
## -0.125 400.28
## 0.0 124.66
## 0.125 59.30
## 0.25 36.71
## 0.50 20.37
## 0.75 14.06
## 1.00 10.75
## Waldmann (1986),
## one- and two-sided CUSUM
## one-sided case
k <- .5
h <- 3
mu <- c(-.5,0,.5)
round(sapply(mu,k=k,h=h,xcusum.arl),digits=2)
## results in the original paper are 1963, 117.4, and 17.35, resp.
## (in Tables 3, 1, and 5, resp.).
## two-sided case
k <- .6
52 xcusum.crit
h <- 3
round(xcusum.arl(k,h,-.2,sided="two"),digits=1) # fits to Waldmann's setup
k <- .5
h <- 3.73
mu <- c(0,.25,.5,.75,1,1.5,2,2.5,3,4,5)
round(cbind(mu,sapply(mu,k=k,h=h,sided="Crosier",xcusum.arl)),digits=2)
## one-sided
k <- .25
h <- 8
mu <- 2.5
print(xcusum.arl(k,h,mu),digits=12)
print(xcusum.arl(k,h,mu,hs=.1),digits=12)
## two-sided
print(xcusum.arl(k,h,mu,sided="two"),digits=12)
Description
Computation of the decision intervals (alarm limits) for different types of CUSUM control charts
monitoring normal mean.
Usage
Arguments
Details
xcusum.crit determines the decision interval (alarm limit) for given in-control ARL L0 by apply-
ing secant rule and using xcusum.arl().
Value
Author(s)
Sven Knoth
See Also
Examples
k <- .5
incontrolARL <- c(500,5000,50000)
sapply(incontrolARL,k=k,xcusum.crit,r=10) # accuracy with 10 nodes
sapply(incontrolARL,k=k,xcusum.crit,r=20) # accuracy with 20 nodes
sapply(incontrolARL,k=k,xcusum.crit) # accuracy with 30 nodes
54 xcusum.crit.L0h
xcusum.crit.L0h Compute the CUSUM reference value k for given in-control ARL and
threshold h
Description
Computation of the reference value k for one-sided CUSUM control charts monitoring normal
mean, if the in-control ARL L0 and the alarm threshold h are given.
Usage
Arguments
L0 in-control ARL.
h alarm level of the CUSUM control chart.
hs so-called headstart (enables fast initial response).
sided distinguishes between one-, two-sided and Crosier’s modified two-sided CUSUM
scheme choosing "one", "two", and "Crosier", respectively.
r number of quadrature nodes, dimension of the resulting linear equation system
is equal to r+1 (one-, two-sided) or 2r+1 (Crosier).
L0.eps error bound for the L0 error.
k.eps bound for the difference of two successive values of k.
Details
xcusum.crit.L0h determines the reference value k for given in-control ARL L0 and alarm level h
by applying secant rule and using xcusum.arl(). Note that not for any combination of L0 and h a
solution exists – for given L0 there is a maximal value for h to get a valid result k.
Value
Author(s)
Sven Knoth
See Also
Examples
L0 <- 100
h.max <- xcusum.crit(0, L0, 0)
hs <- (300:1)/100
hs <- hs[hs < h.max]
ks <- NULL
for ( h in hs ) ks <- c(ks, xcusum.crit.L0h(L0, h))
k.max <- qnorm( 1 - 1/L0 )
plot(hs, ks, type="l", ylim=c(0, max(k.max, ks)), xlab="h", ylab="k")
abline(h=c(0, k.max), col="red")
xcusum.crit.L0L1 Compute the CUSUM k and h for given in-control ARL L0 and out-of-
control L1
Description
Computation of the reference value k and the alarm threshold h for one-sided CUSUM control
charts monitoring normal mean, if the in-control ARL L0 and the out-of-control L1 are given.
Usage
xcusum.crit.L0L1(L0, L1, hs=0, sided="one", r=30, L1.eps=1e-6, k.eps=1e-8)
Arguments
L0 in-control ARL.
L1 out-of-control ARL.
hs so-called headstart (enables fast initial response).
sided distinguishes between one-, two-sided and Crosier’s modified two-sided CUSUM
schemoosing "one", "two", and "Crosier", respectively.
r number of quadrature nodes, dimension of the resulting linear equation system
is equal to r+1 (one-, two-sided) or 2r+1 (Crosier).
L1.eps error bound for the L1 error.
k.eps bound for the difference of two successive values of k.
Details
xcusum.crit.L0L1 determines the reference value k and the alarm threshold h for given in-control
ARL L0 and out-of-control ARL L1 by applying secant rule and using xcusum.arl() and xcusum.crit().
These CUSUM design rules were firstly (and quite rarely afterwards) used by Ewan and Kemp.
Value
Returns two values which resemble the reference value k and the threshold h.
56 xcusum.crit.L0L1
Author(s)
Sven Knoth
References
W. D. Ewan and K. W. Kemp (1960), Sampling inspection of continuous processes with no auto-
correlation between successive results, Biometrika 47, 363-380.
K. W. Kemp (1962), The Use of Cumulative Sums for Sampling Inspection Schemes, Journal of
the Royal Statistical Sociecty C, Applied Statistics, 10, 16-31.
See Also
xcusum.arl for zero-state ARL and xcusum.crit for threshold h computation.
Examples
## Table 2 from Ewan/Kemp (1960) -- one-sided CUSUM
#
# A.R.L. at A.Q.L. A.R.L. at A.Q.L. k h
# 1000 3 1.12 2.40
# 1000 7 0.65 4.06
# 500 3 1.04 2.26
# 500 7 0.60 3.80
# 250 3 0.94 2.11
# 250 7 0.54 3.51
#
L0.set <- c(1000, 500, 250)
L1.set <- c(3, 7)
cat("\nL0\tL1\tk\th\n")
for ( L0 in L0.set ) {
for ( L1 in L1.set ) {
result <- round(xcusum.crit.L0L1(L0, L1), digits=2)
cat(paste(L0, L1, result[1], result[2], sep="\t"), "\n")
}
}
#
# two confirmation runs
xcusum.arl(0.54, 3.51, 0) # Ewan/Kemp
xcusum.arl(result[1], result[2], 0) # here
xcusum.arl(0.54, 3.51, 2*0.54) # Ewan/Kemp
xcusum.arl(result[1], result[2], 2*result[1]) # here
#
## Table II from Kemp (1962) -- two-sided CUSUM
#
# Lr k
# La=250 La=500 La=1000
# 2.5 1.05 1.17 1.27
# 3.0 0.94 1.035 1.13
# 4.0 0.78 0.85 0.92
# 5.0 0.68 0.74 0.80
# 6.0 0.60 0.655 0.71
xcusum.q 57
Description
Computation of quantiles of the Run Length (RL)for CUSUM control charts monitoring normal
mean.
Usage
xcusum.q(k, h, mu, alpha, hs=0, sided="one", r=40)
Arguments
k reference value of the CUSUM control chart.
h decision interval (alarm limit, threshold) of the CUSUM control chart.
mu true mean.
alpha quantile level.
hs so-called headstart (enables fast initial response).
sided distinguishes between one- and two-sided CUSUM control chart by choosing
"one" and "two", respectively.
r number of quadrature nodes, dimension of the resulting linear equation system
is equal to r+1.
Details
Instead of the popular ARL (Average Run Length) quantiles of the CUSUM stopping time (Run
Length) are determined. The algorithm is based on Waldmann’s survival function iteration proce-
dure.
Value
Returns a single value which resembles the RL quantile of order q.
58 xcusum.sf
Author(s)
Sven Knoth
References
K.-H. Waldmann (1986), Bounds for the distribution of the run length of one-sided and two-sided
CUSUM quality control schemes, Technometrics 28, 61-67.
See Also
xcusum.arl for zero-state ARL computation of CUSUM control charts.
Examples
## Waldmann (1986), one-sided CUSUM, Table 2
## original values are 345, 82, 9
Description
Computation of the survival function of the Run Length (RL) for CUSUM control charts monitoring
normal mean.
Usage
xcusum.sf(k, h, mu, n, hs=0, sided="one", r=40)
Arguments
k reference value of the CUSUM control chart.
h decision interval (alarm limit, threshold) of the CUSUM control chart.
mu true mean.
n calculate sf up to value n.
hs so-called headstart (enables fast initial response).
sided distinguishes between one- and two-sided CUSUM control chart by choosing
"one" and "two", respectively.
r number of quadrature nodes, dimension of the resulting linear equation system
is equal to r+1.
xDcusum.arl 59
Details
The survival function P(L>n) and derived from it also the cdf P(L<=n) and the pmf P(L=n) illustrate
the distribution of the CUSUM run length. For large n the geometric tail could be exploited. That
is, with reasonable large n the complete distribution is characterized. The algorithm is based on
Waldmann’s survival function iteration procedure.
Value
Returns a vector which resembles the survival function up to a certain point.
Author(s)
Sven Knoth
References
K.-H. Waldmann (1986), Bounds for the distribution of the run length of one-sided and two-sided
CUSUM quality control schemes, Technometrics 28, 61-67.
See Also
xcusum.q for computation of CUSUM run length quantiles.
Examples
## Waldmann (1986), one-sided CUSUM, Table 2
k <- .5
h <- 3
mu <- 0 # corresponds to Waldmann's -0.5
SF <- xcusum.sf(k, h, 0, 1000)
plot(1:length(SF), SF, type="l", xlab="n", ylab="P(L>n)", ylim=c(0,1))
#
Description
Computation of the (zero-state and other) Average Run Length (ARL) under drift for one-sided
CUSUM control charts monitoring normal mean.
Usage
xDcusum.arl(k, h, delta, hs = 0, sided = "one",
mode = "Gan", m = NULL, q = 1, r = 30, with0 = FALSE)
60 xDcusum.arl
Arguments
k reference value of the CUSUM control chart.
h decision interval (alarm limit, threshold) of the CUSUM control chart.
delta true drift parameter.
hs so-called headstart (enables fast initial response).
sided distinguishes between one- and two-sided CUSUM control chart by choosing
"one" and "two", respectively. Currentlly, the two-sided scheme is not imple-
mented.
mode decide whether Gan’s or Knoth’s approach is used. Use "Gan" and "Knoth",
respectively.
m parameter used if mode="Gan". m is design parameter of Gan’s approach. If
m=NULL, then m will increased until the resulting ARL does not change anymore.
q change point position. For q = 1 and µ = µ0 and µ = µ1 , the usual zero-state
ARLs for the in-control and out-of-control case, respectively, are calculated.
For q > 1 and µ! = 0 conditional delays, that is, Eq (L − q + 1|L ≥), will
be determined. Note that mu0=0 is implicitely fixed. Deploy large q to mimic
steady-state. It works only for mode="Knoth".
r number of quadrature nodes, dimension of the resulting linear equation system
is equal to r+1 (one-sided) or r (two-sided).
with0 defines whether the first observation used for the RL calculation follows already
1*delta or still 0*delta. With q additional flexibility is given.
Details
Based on Gan (1991) or Knoth (2003), the ARL is calculated for one-sided CUSUM control charts
under drift. In case of Gan’s framework, the usual ARL function with mu=m*delta is determined
and recursively via m-1, m-2, ... 1 (or 0) the drift ARL determined. The framework of Knoth allows
to calculate ARLs for varying parameters, such as control limits and distributional parameters. For
details see the cited papers. Note that two-sided CUSUM charts under drift are difficult to treat.
Value
Returns a single value which resembles the ARL.
Author(s)
Sven Knoth
References
F. F. Gan (1992), CUSUM control charts under linear drift, Statistician 41, 71-84.
F. F. Gan (1996), Average Run Lengths for Cumulative Sum control chart under linear trend, Ap-
plied Statistics 45, 505-512.
S. Knoth (2003), EWMA schemes with non-homogeneous transition kernels, Sequential Analysis
22, 241-255.
xDcusum.arl 61
S. Knoth (2012), More on Control Charting under Drift, in: Frontiers in Statistical Quality Control
10, H.-J. Lenz, W. Schmid and P.-T. Wilrich (Eds.), Physica Verlag, Heidelberg, Germany, 53-68.
C. Zou, Y. Liu and Z. Wang (2009), Comparisons of control schemes for monitoring the means of
processes subject to drifts, Metrika 70, 141-163.
See Also
xcusum.arl and xcusum.ad for zero-state and steady-state ARL computation of CUSUM control
charts for the classical step change model.
Examples
## Gan (1992)
## Table 1
## original values are
# deltas arl
# 0.0001 475
# 0.0005 261
# 0.0010 187
# 0.0020 129
# 0.0050 76.3
# 0.0100 52.0
# 0.0200 35.2
# 0.0500 21.4
# 0.1000 15.0
# 0.5000 6.95
# 1.0000 5.16
# 3.0000 3.30
## Not run: k <- .25
h <- 8
r <- 50
DxDcusum.arl <- Vectorize(xDcusum.arl, "delta")
deltas <- c(0.0001, 0.0005, 0.001, 0.002, 0.005, 0.01, 0.02, 0.05, 0.1, 0.5, 1, 3)
arl.like.Gan <-
round(DxDcusum.arl(k, h, deltas, r=r, with0=TRUE), digits=2)
arl.like.Knoth <-
round(DxDcusum.arl(k, h, deltas, r=r, mode="Knoth", with0=TRUE), digits=2)
data.frame(deltas, arl.like.Gan, arl.like.Knoth)
## End(Not run)
Description
Computation of the (zero-state and other) Average Run Length (ARL) under drift for different types
of EWMA control charts monitoring normal mean.
Usage
xDewma.arl(l, c, delta, zr = 0, hs = 0, sided = "one", limits = "fix",
mode = "Gan", m = NULL, q = 1, r = 40, with0 = FALSE)
Arguments
l smoothing parameter lambda of the EWMA control chart.
c critical value (similar to alarm limit) of the EWMA control chart.
delta true drift parameter.
zr reflection border for the one-sided chart.
hs so-called headstart (enables fast initial response).
sided distinguish between one- and two-sided EWMA control chart by choosing "one"
and "two", respectively.
limits distinguishes between different control limits behavior.
mode decide whether Gan’s or Knoth’s approach is used. Use "Gan" and "Knoth",
respectively.
xDewma.arl 63
Details
Based on Gan (1991) or Knoth (2003), the ARL is calculated for EWMA control charts under
drift. In case of Gan’s framework, the usual ARL function with mu=m*delta is determined and
recursively via m-1, m-2, ... 1 (or 0) the drift ARL determined. The framework of Knoth allows
to calculate ARLs for varying parameters, such as control limits and distributional parameters. For
details see the cited papers.
Value
Returns a single value which resembles the ARL.
Author(s)
Sven Knoth
References
F. F. Gan (1991), EWMA control chart under linear drift, J. Stat. Comput. Simulation 38, 181-200.
L. A. Aerne, C. W. Champ and S. E. Rigdon (1991), Evaluation of control charts under linear trend,
Commun. Stat., Theory Methods 20, 3341-3349.
S. Knoth (2003), EWMA schemes with non-homogeneous transition kernels, Sequential Analysis
22, 241-255.
H. M. Fahmy and E. A. Elsayed (2006), Detection of linear trends in process mean, International
Journal of Production Research 44, 487-504.
S. Knoth (2012), More on Control Charting under Drift, in: Frontiers in Statistical Quality Control
10, H.-J. Lenz, W. Schmid and P.-T. Wilrich (Eds.), Physica Verlag, Heidelberg, Germany, 53-68.
C. Zou, Y. Liu and Z. Wang (2009), Comparisons of control schemes for monitoring the means of
processes subject to drifts, Metrika 70, 141-163.
See Also
xewma.arl and xewma.ad for zero-state and steady-state ARL computation of EWMA control
charts for the classical step change model.
64 xDewma.arl
Examples
## Not run:
DxDewma.arl <- Vectorize(xDewma.arl, "delta")
## Gan (1991)
## Table 1
## original values are
# delta arlE1 arlE2 arlE3
# 0 500 500 500
# 0.0001 482 460 424
# 0.0010 289 231 185
# 0.0020 210 162 129
# 0.0050 126 94.6 77.9
# 0.0100 81.7 61.3 52.7
# 0.0500 27.5 21.8 21.9
# 0.1000 17.0 14.2 15.3
# 1.0000 4.09 4.28 5.25
# 3.0000 2.60 2.90 3.43
#
lambda1 <- 0.676
lambda2 <- 0.242
lambda3 <- 0.047
h1 <- 2.204/sqrt(lambda1/(2-lambda1))
h2 <- 1.111/sqrt(lambda2/(2-lambda2))
h3 <- 0.403/sqrt(lambda3/(2-lambda3))
deltas <- c(.0001, .001, .002, .005, .01, .05, .1, 1, 3)
arlE10 <- round(xewma.arl(lambda1, h1, 0, sided="two"), digits=2)
arlE1 <- c(arlE10, round(DxDewma.arl(lambda1, h1, deltas, sided="two", with0=TRUE),
digits=2))
arlE20 <- round(xewma.arl(lambda2, h2, 0, sided="two"), digits=2)
arlE2 <- c(arlE20, round(DxDewma.arl(lambda2, h2, deltas, sided="two", with0=TRUE),
digits=2))
arlE30 <- round(xewma.arl(lambda3, h3, 0, sided="two"), digits=2)
arlE3 <- c(arlE30, round(DxDewma.arl(lambda3, h3, deltas, sided="two", with0=TRUE),
digits=2))
data.frame(delta=c(0, deltas), arlE1, arlE2, arlE3)
digits=2))
arlE30 <- round(xewma.arl(lambda3, h3, 0, sided="two"), digits=2)
arlE3 <- c(arlE30, round(DxDewma.arl(lambda3, h3, deltas, sided="two", with0=TRUE),
digits=2))
data.frame(delta=c(0, deltas), arlE1, arlE2, arlE3)
c3 <- 3.161
zr <- -6
r <- 50
deltas <- c(0.0005, 0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1:4)
arl1 <- c(round(xewma.arl(l1, c1, 0, zr=zr, r=r), digits=2),
round(DxDewma.arl(l1, c1, deltas, zr=zr, r=r), digits=2))
arl2 <- c(round(xewma.arl(l2, c2, 0, zr=zr), digits=2),
round(DxDewma.arl(l2, c2, deltas, zr=zr, r=r), digits=2))
arl3 <- c(round(xewma.arl(l3, c3, 0, zr=zr, r=r), digits=2),
round(DxDewma.arl(l3, c3, deltas, zr=zr, r=r), digits=2))
data.frame(delta=c(0, deltas), arl1, arl2, arl3)
## End(Not run)
Description
Computation of the (zero-state and other) Average Run Length (ARL) under drift for Shiryaev-
Roberts schemes monitoring normal mean.
Usage
xDgrsr.arl(k, g, delta, zr = 0, hs = NULL, sided = "one", m = NULL,
mode = "Gan", q = 1, r = 30, with0 = FALSE)
Arguments
k reference value of the Shiryaev-Roberts scheme.
g control limit (alarm threshold) of Shiryaev-Roberts scheme.
delta true drift parameter.
zr reflection border for the one-sided chart.
hs so-called headstart (enables fast initial response).
sided distinguishes between one- and two-sided Shiryaev-Roberts schemes by choos-
ing "one" and "two", respectively. Currentlly, the two-sided scheme is not im-
plemented.
m parameter used if mode="Gan". m is design parameter of Gan’s approach. If
m=NULL, then m will increased until the resulting ARL does not change anymore.
q change point position. For q = 1 and µ = µ0 and µ = µ1 , the usual zero-state
ARLs for the in-control and out-of-control case, respectively, are calculated.
For q > 1 and µ! = 0 conditional delays, that is, Eq (L − q + 1|L ≥), will
be determined. Note that mu0=0 is implicitely fixed. Deploy large q to mimic
steady-state. It works only for mode="Knoth".
mode decide whether Gan’s or Knoth’s approach is used. Use "Gan" and "Knoth",
respectively. "Knoth" is not implemented yet.
68 xDgrsr.arl
Details
Based on Gan (1991) or Knoth (2003), the ARL is calculated for Shiryaev-Roberts schemes under
drift. In case of Gan’s framework, the usual ARL function with mu=m*delta is determined and
recursively via m-1, m-2, ... 1 (or 0) the drift ARL determined. The framework of Knoth allows
to calculate ARLs for varying parameters, such as control limits and distributional parameters. For
details see the cited papers.
Value
Returns a single value which resembles the ARL.
Author(s)
Sven Knoth
References
F. F. Gan (1991), EWMA control chart under linear drift, J. Stat. Comput. Simulation 38, 181-200.
S. Knoth (2003), EWMA schemes with non-homogeneous transition kernels, Sequential Analysis
22, 241-255.
S. Knoth (2012), More on Control Charting under Drift, in: Frontiers in Statistical Quality Control
10, H.-J. Lenz, W. Schmid and P.-T. Wilrich (Eds.), Physica Verlag, Heidelberg, Germany, 53-68.
C. Zou, Y. Liu and Z. Wang (2009), Comparisons of control schemes for monitoring the means of
processes subject to drifts, Metrika 70, 141-163.
See Also
xewma.arl and xewma.ad for zero-state and steady-state ARL computation of EWMA control
charts for the classical step change model.
Examples
## Not run:
## Monte Carlo example with 10^8 replicates
# delta arl s.e.
# 0.0001 381.8240 0.0304
# 0.0005 238.4630 0.0148
# 0.001 177.4061 0.0097
# 0.002 125.9055 0.0061
# 0.005 75.7574 0.0031
# 0.01 50.2203 0.0018
# 0.02 32.9458 0.0011
# 0.05 18.9213 0.0005
xDshewhartrunsrules.arl 69
## End(Not run)
xDshewhartrunsrules.arl
Compute ARLs of Shewhart control charts with and without runs rules
under drift
Description
Computation of the zero-state Average Run Length (ARL) under drift for Shewhart control charts
with and without runs rules monitoring normal mean.
Usage
xDshewhartrunsrules.arl(delta, c = 1, m = NULL, type = "12")
Arguments
delta true drift parameter.
c normalizing constant to ensure specific alarming behavior.
type controls the type of Shewhart chart used, seed details section.
m parameter of Gan’s approach. If m=NULL, then m will increased until the resulting
ARL does not change anymore.
Details
Based on Gan (1991), the ARL is calculated for Shewhart control charts with and without runs
rules under drift. The usual ARL function with mu=m*delta is determined and recursively via m-1,
m-2, ... 1 (or 0) the drift ARL determined. xDshewhartrunsrulesFixedm.arl is the actual work
horse, while xDshewhartrunsrules.arl provides a convenience wrapper. Note that Aerne et al.
(1991) deployed a method that is quite similar to Gan’s algorithm. For type see the help page of
xshewhartrunsrules.arl.
70 xDshewhartrunsrules.arl
Value
Returns a single value which resembles the ARL.
Author(s)
Sven Knoth
References
F. F. Gan (1991), EWMA control chart under linear drift, J. Stat. Comput. Simulation 38, 181-200.
L. A. Aerne, C. W. Champ and S. E. Rigdon (1991), Evaluation of control charts under linear trend,
Commun. Stat., Theory Methods 20, 3341-3349.
See Also
xshewhartrunsrules.arl for zero-state ARL computation of Shewhart control charts with and
without runs rules for the classical step change model.
Examples
## Aerne et al. (1991)
## Table I (continued)
## original numbers are
# delta arl1of1 arl2of3 arl4of5 arl10
# 0.005623 136.67 120.90 105.34 107.08
# 0.007499 114.98 101.23 88.09 89.94
# 0.010000 96.03 84.22 73.31 75.23
# 0.013335 79.69 69.68 60.75 62.73
# 0.017783 65.75 57.38 50.18 52.18
# 0.023714 53.99 47.06 41.33 43.35
# 0.031623 44.15 38.47 33.99 36.00
# 0.042170 35.97 31.36 27.91 29.90
# 0.056234 29.21 25.51 22.91 24.86
# 0.074989 23.65 20.71 18.81 20.70
# 0.100000 19.11 16.79 15.45 17.29
# 0.133352 15.41 13.61 12.72 14.47
# 0.177828 12.41 11.03 10.50 12.14
# 0.237137 9.98 8.94 8.71 10.18
# 0.316228 8.02 7.25 7.26 8.45
# 0.421697 6.44 5.89 6.09 6.84
# 0.562341 5.17 4.80 5.15 5.48
# 0.749894 4.16 3.92 4.36 4.39
# 1.000000 3.35 3.22 3.63 3.52
c1of1 <- 3.069/3
c2of3 <- 2.1494/2
c4of5 <- 1.14
c10 <- 3.2425/3
DxDshewhartrunsrules.arl <- Vectorize(xDshewhartrunsrules.arl, "delta")
deltas <- 10^(-(18:0)/8)
arl1of1 <-
round(DxDshewhartrunsrules.arl(deltas, c=c1of1, type="1"), digits=2)
xewma.ad 71
arl2of3 <-
round(DxDshewhartrunsrules.arl(deltas, c=c2of3, type="12"), digits=2)
arl4of5 <-
round(DxDshewhartrunsrules.arl(deltas, c=c4of5, type="13"), digits=2)
arl10 <-
round(DxDshewhartrunsrules.arl(deltas, c=c10, type="SameSide10"), digits=2)
data.frame(delta=round(deltas, digits=6), arl1of1, arl2of3, arl4of5, arl10)
Description
Computation of the steady-state Average Run Length (ARL) for different types of EWMA control
charts monitoring normal mean.
Usage
xewma.ad(l, c, mu1, mu0=0, zr=0, z0=0, sided="one", limits="fix",
steady.state.mode="conditional", r=40)
Arguments
l smoothing parameter lambda of the EWMA control chart.
c critical value (similar to alarm limit) of the EWMA control chart.
mu1 out-of-control mean.
mu0 in-control mean.
zr reflection border for the one-sided chart.
z0 restarting value of the EWMA sequence in case of a false alarm in steady.state.mode="cyclical".
sided distinguishes between one- and two-sided two-sided EWMA control chart by
choosing "one" and "two", respectively.
limits distinguishes between different control limits behavior.
steady.state.mode
distinguishes between two steady-state modes – conditional and cyclical.
r number of quadrature nodes, dimension of the resulting linear equation system
is equal to r+1 (one-sided) or r (two-sided).
Details
xewma.ad determines the steady-state Average Run Length (ARL) by numerically solving the re-
lated ARL integral equation by means of the Nystroem method based on Gauss-Legendre quadra-
ture and using the power method for deriving the largest in magnitude eigenvalue and the related
left eigenfunction.
72 xewma.ad
Value
Returns a single value which resembles the steady-state ARL.
Author(s)
Sven Knoth
References
R. B. Crosier (1986), A new two-sided cumulative quality control scheme, Technometrics 28, 187-
194.
S. V. Crowder (1987), A simple method for studying run-length distributions of exponentially
weighted moving average charts, Technometrics 29, 401-407.
J. M. Lucas and M. S. Saccucci (1990), Exponentially weighted moving average control schemes:
Properties and enhancements, Technometrics 32, 1-12.
See Also
xewma.arl for zero-state ARL computation and xcusum.ad for the steady-state ARL of CUSUM
control charts.
Examples
## comparison of zero-state (= worst case ) and steady-state performance
## for two-sided EWMA control charts
l <- .1
c <- xewma.crit(l,500,sided="two")
mu <- c(0,.5,1,1.5,2)
arl <- sapply(mu,l=l,c=c,sided="two",xewma.arl)
ad <- sapply(mu,l=l,c=c,sided="two",xewma.ad)
round(cbind(mu,arl,ad),digits=2)
## Lucas/Saccucci (1990)
## two-sided EWMA
Description
Computation of the (zero-state) Average Run Length (ARL) for different types of EWMA control
charts monitoring normal mean.
Usage
xewma.arl(l,c,mu,zr=0,hs=0,sided="one",limits="fix",q=1,r=40)
Arguments
l smoothing parameter lambda of the EWMA control chart.
c critical value (similar to alarm limit) of the EWMA control chart.
mu true mean.
zr reflection border for the one-sided chart.
hs so-called headstart (enables fast initial response).
sided distinguishes between one- and two-sided EWMA control chart by choosing
"one" and "two", respectively.
limits distinguishes between different control limits behavior.
q change point position. For q = 1 and µ = µ0 and µ = µ1 , the usual zero-state
ARLs for the in-control and out-of-control case, respectively, are calculated. For
q > 1 and µ! = 0 conditional delays, that is, Eq (L − q + 1|L ≥ q), will be
determined. Note that mu0=0 is implicitely fixed.
r number of quadrature nodes, dimension of the resulting linear equation system
is equal to r+1 (one-sided) or r (two-sided).
Details
In case of the EWMA chart with fixed control limits, xewma.arl determines the Average Run
Length (ARL) by numerically solving the related ARL integral equation by means of the Nystroem
method based on Gauss-Legendre quadrature. If limits is not "fix", then the method presented in
Knoth (2003) is utilized. Note that for one-sided EWMA charts (sided="one"), only "vacl" and
"stat" are deployed, while for two-sided ones (sided="two") also "fir", "both" (combination
of "fir" and "vacl"), and "Steiner" are implemented. For details see Knoth (2004).
74 xewma.arl
Value
Except for the fixed limits EWMA charts it returns a single value which resembles the ARL. For
fixed limits charts, it returns a vector of length q which resembles the ARL and the sequence of
conditional expected delays for q=1 and q>1, respectively.
Author(s)
Sven Knoth
References
K.-H. Waldmann (1986), Bounds for the distribution of the run length of geometric moving average
charts, Appl. Statist. 35, 151-158.
S. V. Crowder (1987), A simple method for studying run-length distributions of exponentially
weighted moving average charts, Technometrics 29, 401-407.
J. M. Lucas and M. S. Saccucci (1990), Exponentially weighted moving average control schemes:
Properties and enhancements, Technometrics 32, 1-12.
S. Chandrasekaran, J. R. English and R. L. Disney (1995), Modeling and analysis of EWMA control
schemes with variance-adjusted control limits, IIE Transactions 277, 282-290.
T. R. Rhoads, D. C. Montgomery and C. M. Mastrangelo (1996), Fast initial response scheme for
exponentially weighted moving average control chart, Quality Engineering 9, 317-327.
S. H. Steiner (1999), EWMA control charts with time-varying control limits and fast initial re-
sponse, Journal of Quality Technology 31, 75-86.
S. Knoth (2003), EWMA schemes with non-homogeneous transition kernels, Sequential Analysis
22, 241-255.
S. Knoth (2004), Fast initial response features for EWMA Control Charts, Statistical Papers 46,
47-64.
See Also
xcusum.arl for zero-state ARL computation of CUSUM control charts and xewma.ad for the
steady-state ARL.
Examples
## Waldmann (1986), one-sided EWMA
l <- .75
round(xewma.arl(l,2*sqrt((2-l)/l),0,zr=-4*sqrt((2-l)/l)),digits=1)
l <- .5
round(xewma.arl(l,2*sqrt((2-l)/l),0,zr=-4*sqrt((2-l)/l)),digits=1)
## original values are 209.3 and 3907.5 (in Table 2).
## Lucas/Saccucci (1990)
## two-sided EWMA
## Not run:
## with fir feature
l1 <- .5
l2 <- .03
c1 <- 3.071
c2 <- 2.437
hs1 <- c1/2
hs2 <- c2/2
mu <- c(0,.5,1,2,3,5)
arl1 <- sapply(mu,l=l1,c=c1,hs=hs1,sided="two",limits="fir",xewma.arl)
arl2 <- sapply(mu,l=l2,c=c2,hs=hs2,sided="two",limits="fir",xewma.arl)
round(cbind(mu,arl1,arl2),digits=2)
l1 <- .25
l2 <- .1
c1s <- 2.9985
c1n <- 3.0042
c2s <- 2.8159
c2n <- 2.8452
mu <- c(0,.25,.5,.75,1,2)
arl1s <- sapply(mu,l=l1,c=c1s,sided="two",xewma.arl)
arl1n <- sapply(mu,l=l1,c=c1n,sided="two",limits="vacl",xewma.arl)
arl2s <- sapply(mu,l=l2,c=c2s,sided="two",xewma.arl)
arl2n <- sapply(mu,l=l2,c=c2n,sided="two",limits="vacl",xewma.arl)
round(cbind(mu,arl1s,arl1n,arl2s,arl2n),digits=2)
l <- .03
c <- 2.437
mu <- c(0,.5,1,1.5,2,3,4)
sl <- sqrt(l*(2-l))
arlfix <- sapply(mu,l=l,c=c,sided="two",xewma.arl)
arlvacl <- sapply(mu,l=l,c=c,sided="two",limits="vacl",xewma.arl)
arlfir <- sapply(mu,l=l,c=c,hs=c/2,sided="two",limits="fir",xewma.arl)
arlboth <- sapply(mu,l=l,c=c,hs=c/2*sl,sided="two",limits="both",xewma.arl)
round(cbind(mu,arlfix,arlvacl,arlfir,arlboth),digits=1)
## Steiner (1999)
## two-sided EWMA control charts with various modifications
l <- .05
c <- 3
mu <- c(0,.25,.5,.75,1,1.5,2,2.5,3,3.5,4)
arlfix <- sapply(mu,l=l,c=c,sided="two",xewma.arl)
arlvacl <- sapply(mu,l=l,c=c,sided="two",limits="vacl",xewma.arl)
round(cbind(mu,arlfix,arlvacl),digits=1)
l <- .03
cfir <- 2.44
cboth <- 2.54
cstein <- 2.55
hsfir <- cfir/2
hsboth <- cboth/2*sqrt(l*(2-l))
mu <- c(0,.5,1,1.5,2,3,4)
arlfir <- sapply(mu,l=l,c=cfir,hs=hsfir,sided="two",limits="fir",xewma.arl)
arlboth <- sapply(mu,l=l,c=cboth,hs=hsboth,sided="two",limits="both",xewma.arl)
arlstein <- sapply(mu,l=l,c=cstein,sided="two",limits="Steiner",xewma.arl)
round(cbind(mu,arlfir,arlboth,arlstein),digits=1)
l <- .25
c <- 3
mu <- 1
print(xewma.arl(l,c,mu,sided="two"),digits=11)
lambda <- .1
L0 <- 500
# 1 6.7596 0.0001
# 1.5 3.5398 0.0001
# 2 2.3038 0.0000
# 2.5 1.7004 0.0000
# 3 1.3675 0.0000
zr <- -6
r <- 50
c <- xewma.crit(lambda, L0, zr=zr, limits="vacl", r=r)
Mxewma.arl <- Vectorize(xewma.arl, "mu")
mus <- (0:6)/2
arls <- round(Mxewma.arl(lambda, c, mus, zr=zr, limits="vacl", r=r), digits=4)
data.frame(mus, arls)
## End(Not run)
Description
Computation of the (zero-state) Average Run Length (ARL) function for different types of EWMA
control charts monitoring normal mean.
Usage
xewma.arl.f(l,c,mu,zr=0,sided="one",limits="fix",r=40)
Arguments
l smoothing parameter lambda of the EWMA control chart.
c critical value (similar to alarm limit) of the EWMA control chart.
mu true mean.
80 xewma.arl.prerun
Details
It is a convenience function to yield the ARL as function of the head start hs. For more details see
xewma.arl.
Value
It returns a function of a single argument, hs=x which maps the head-start value hs to the ARL.
Author(s)
Sven Knoth
References
See Also
Examples
# will follow
Description
Computation of the (zero-state) Average Run Length (ARL) for different types of EWMA control
charts monitoring normal mean if the in-control mean, standard deviation, or both are estimated by
a pre run.
xewma.arl.prerun 81
Usage
xewma.arl.prerun(l, c, mu, zr=0, hs=0, sided="two", limits="fix", q=1,
size=100, df=NULL, estimated="mu", qm.mu=30, qm.sigma=30, truncate=1e-10)
Arguments
l smoothing parameter lambda of the EWMA control chart.
c critical value (similar to alarm limit) of the EWMA control chart.
mu true mean shift.
zr reflection border for the one-sided chart.
hs so-called headstart (give fast initial response).
sided distinguish between one- and two-sided EWMA control chart by choosing "one"
and "two", respectively.
limits distinguish between different control limits behavior.
q change point position. For q = 1 and µ = µ0 and µ = µ1 , the usual zero-state
ARLs for the in-control and out-of-control case, respectively, are calculated. For
q > 1 and µ! = 0 conditional delays, that is, Eq (L − q + 1|L ≥ q), will be
determined. Note that mu0=0 is implicitely fixed.
size pre run sample size.
df Degrees of freedom of the pre run variance estimator. Typically it is simply size
- 1. If the pre run is collected in batches, then also other values are needed.
estimated name the parameter to be estimated within the "mu", "sigma", "both".
qm.mu number of quadrature nodes for convoluting the mean uncertainty.
qm.sigma number of quadrature nodes for convoluting the standard deviation uncertainty.
truncate size of truncated tail.
L0 in-control ARL.
c.error error bound for two succeeding values of the critical value during applying the
secant rule.
L.error error bound for the ARL level L0 during applying the secant rule.
OUTPUT activate or deactivate additional output.
Details
Essentially, the ARL function xewma.arl is convoluted with the distribution of the sample mean,
standard deviation or both. For details see Jones/Champ/Rigdon (2001) and Knoth (2014?).
Value
Returns a single value which resembles the ARL.
82 xewma.arl.prerun
Author(s)
Sven Knoth
References
L. A. Jones, C. W. Champ, S. E. Rigdon (2001), The performance of exponentially weighted moving
average charts with estimated parameters, Technometrics 43, 156-167.
S. Knoth (2003), EWMA schemes with non-homogeneous transition kernels, Sequential Analysis
22, 241-255.
S. Knoth (2004), Fast initial response features for EWMA Control Charts, Statistical Papers 46,
47-64.
S. Knoth (2014?), tbd, tbd, tbd-tbd.
See Also
xewma.arl for the usual zero-state ARL computation.
Examples
## Jones/Champ/Rigdon (2001)
## Not run:
# Figure 5, subfigure r = 0.2
mu_ <- (0:85)/40
ARL_ <- round(xewma.ARL(lambda, L, mu_, sided="two"), digits=2)
p.ARL_ <- round(xewma.ARL.prerun(lambda, L/C4m, mu_, sided="two",
size=m, df=m*(n-1), estimated="both"), digits=2)
## End(Not run)
Description
Computation of the critical values (similar to alarm limits) for different types of EWMA control
charts monitoring normal mean.
Usage
xewma.crit(l,L0,mu0=0,zr=0,hs=0,sided="one",limits="fix",r=40,c0=NULL)
Arguments
l smoothing parameter lambda of the EWMA control chart.
L0 in-control ARL.
mu0 in-control mean.
zr reflection border for the one-sided chart.
hs so-called headstart (enables fast initial response).
sided distinguishes between one- and two-sided two-sided EWMA control chart by
choosing "one" and "two", respectively.
limits distinguishes between different control limits behavior.
r number of quadrature nodes, dimension of the resulting linear equation system
is equal to r+1 (one-sided) or r (two-sided).
c0 starting value for iteration rule.
Details
xewma.crit determines the critical values (similar to alarm limits) for given in-control ARL L0 by
applying secant rule and using xewma.arl().
Value
Returns a single value which resembles the critical value c.
Author(s)
Sven Knoth
84 xewma.q
References
S. V. Crowder (1989), Design of exponentially weighted moving average schemes, Journal of Qual-
ity Technology 21, 155-162.
See Also
xewma.arl for zero-state ARL computation.
Examples
l <- .1
incontrolARL <- c(500,5000,50000)
sapply(incontrolARL,l=l,sided="two",xewma.crit,r=35) # accuracy with 35 nodes
sapply(incontrolARL,l=l,sided="two",xewma.crit) # accuracy with 40 nodes
sapply(incontrolARL,l=l,sided="two",xewma.crit,r=50) # accuracy with 50 nodes
## Crowder (1989)
## two-sided EWMA control charts with fixed limits
l <- c(.05,.1,.15,.2,.25)
L0 <- 250
round(sapply(l,L0=L0,sided="two",xewma.crit),digits=2)
Description
Computation of quantiles of the Run Length (RL) for EWMA control charts monitoring normal
mean.
Usage
xewma.q(l, c, mu, alpha, zr=0, hs=0, sided="two", limits="fix", q=1, r=40)
Arguments
l smoothing parameter lambda of the EWMA control chart.
c critical value (similar to alarm limit) of the EWMA control chart.
mu true mean.
alpha quantile level.
zr reflection border for the one-sided chart.
xewma.q 85
Details
Instead of the popular ARL (Average Run Length) quantiles of the EWMA stopping time (Run
Length) are determined. The algorithm is based on Waldmann’s survival function iteration proce-
dure. If limits is not "fix", then the method presented in Knoth (2003) is utilized. Note that
for one-sided EWMA charts (sided="one"), only "vacl" and "stat" are deployed, while for two-
sided ones (sided="two") also "fir", "both" (combination of "fir" and "vacl"), and "Steiner"
are implemented. For details see Knoth (2004).
Value
Returns a single value which resembles the RL quantile of order q.
Author(s)
Sven Knoth
References
F. F. Gan (1993), An optimal design of EWMA control charts based on the median run length, J.
Stat. Comput. Simulation 45, 169-184.
S. Knoth (2003), EWMA schemes with non-homogeneous transition kernels, Sequential Analysis
22, 241-255.
S. Knoth (2004), Fast initial response features for EWMA Control Charts, Statistical Papers 46,
47-64.
S. Knoth (2015), Run length quantiles of EWMA control charts monitoring normal mean or/and
variance, International Journal of Production Research 53, 4629-4647.
K.-H. Waldmann (1986), Bounds for the distribution of the run length of geometric moving average
charts, Appl. Statist. 35, 151-158.
86 xewma.q.prerun
See Also
xewma.arl for zero-state ARL computation of EWMA control charts.
Examples
## Gan (1993), two-sided EWMA with fixed control limits
## some values of his Table 1 -- any median RL should be 500
XEWMA.Q <- Vectorize("xewma.q", c("l", "c"))
G.lambda <- c(.05, .1, .15, .2, .25)
G.h <- c(.441, .675, .863, 1.027, 1.177)
MEDIAN <- ceiling(XEWMA.Q(G.lambda, G.h/sqrt(G.lambda/(2-G.lambda)),
0, .5, sided="two"))
print(cbind(G.lambda, MEDIAN))
# (iii) compare Gan's original values and the new ones with 5 digits
print(cbind(G.lambda, G.h.new, G.h))
Description
Computation of quantiles of the Run Length (RL) for EWMA control charts monitoring normal
mean if the in-control mean, standard deviation, or both are estimated by a pre run.
Usage
xewma.q.prerun(l, c, mu, p, zr=0, hs=0, sided="two", limits="fix", q=1, size=100,
df=NULL, estimated="mu", qm.mu=30, qm.sigma=30, truncate=1e-10, bound=1e-10)
Arguments
l smoothing parameter lambda of the EWMA control chart.
c critical value (similar to alarm limit) of the EWMA control chart.
mu true mean shift.
p quantile level.
zr reflection border for the one-sided chart.
hs so-called headstart (give fast initial response).
sided distinguish between one- and two-sided EWMA control chart by choosing "one"
and "two", respectively.
limits distinguish between different control limits behavior.
q change point position. For q = 1 and µ = µ0 and µ = µ1 , the usual zero-state
ARLs for the in-control and out-of-control case, respectively, are calculated.
For q > 1 and µ! = 0 conditional delays, that is, Eq (L − q + 1|L ≥), will be
determined. Note that mu0=0 is implicitely fixed.
size pre run sample size.
df Degrees of freedom of the pre run variance estimator. Typically it is simply size
- 1. If the pre run is collected in batches, then also other values are needed.
estimated name the parameter to be estimated within the "mu", "sigma", "both".
qm.mu number of quadrature nodes for convoluting the mean uncertainty.
qm.sigma number of quadrature nodes for convoluting the standard deviation uncertainty.
truncate size of truncated tail.
bound control when the geometric tail kicks in; the larger the quicker and less accurate;
bound should be larger than 0 and less than 0.001.
L0 in-control quantile value.
c.error error bound for two succeeding values of the critical value during applying the
secant rule.
p.error error bound for the quantile level p during applying the secant rule.
OUTPUT activate or deactivate additional output.
Details
Essentially, the ARL function xewma.q is convoluted with the distribution of the sample mean,
standard deviation or both. For details see Jones/Champ/Rigdon (2001) and Knoth (2014?).
Value
Returns a single value which resembles the RL quantile of order q.
Author(s)
Sven Knoth
88 xewma.q.prerun
References
L. A. Jones, C. W. Champ, S. E. Rigdon (2001), The performance of exponentially weighted moving
average charts with estimated parameters, Technometrics 43, 156-167.
S. Knoth (2003), EWMA schemes with non-homogeneous transition kernels, Sequential Analysis
22, 241-255.
S. Knoth (2004), Fast initial response features for EWMA Control Charts, Statistical Papers 46,
47-64.
S. Knoth (2014?), tbd, tbd, tbd-tbd.
K.-H. Waldmann (1986), Bounds for the distribution of the run length of geometric moving average
charts, Appl. Statist. 35, 151-158.
See Also
xewma.q for the usual RL quantiles computation of EWMA control charts.
Examples
## Jones/Champ/Rigdon (2001)
## Not run:
p.Q1 <- xewma.Q.prerun(lambda, L/C4m, mu, 0.1, sided="two",
size=m, df=m*(n-1), estimated="both")
p.Q2 <- xewma.Q.prerun(lambda, L/C4m, mu, 0.5, sided="two",
size=m, df=m*(n-1), estimated="both")
p.Q3 <- xewma.Q.prerun(lambda, L/C4m, mu, 0.9, sided="two",
size=m, df=m*(n-1), estimated="both")
## End(Not run)
xewma.sf 89
Description
Computation of the survival function of the Run Length (RL) for EWMA control charts monitoring
normal mean.
Usage
Arguments
Details
The survival function P(L>n) and derived from it also the cdf P(L<=n) and the pmf P(L=n) il-
lustrate the distribution of the EWMA run length. For large n the geometric tail could be ex-
ploited. That is, with reasonable large n the complete distribution is characterized. The algorithm
is based on Waldmann’s survival function iteration procedure. For varying limits and for change
points after 1 the algorithm from Knoth (2004) is applied. Note that for one-sided EWMA charts
(sided="one"), only "vacl" and "stat" are deployed, while for two-sided ones (sided="two")
also "fir", "both" (combination of "fir" and "vacl"), and "Steiner" are implemented. For
details see Knoth (2004).
Value
Returns a vector which resembles the survival function up to a certain point.
Author(s)
Sven Knoth
References
F. F. Gan (1993), An optimal design of EWMA control charts based on the median run length, J.
Stat. Comput. Simulation 45, 169-184.
S. Knoth (2003), EWMA schemes with non-homogeneous transition kernels, Sequential Analysis
22, 241-255.
S. Knoth (2004), Fast initial response features for EWMA Control Charts, Statistical Papers 46,
47-64.
K.-H. Waldmann (1986), Bounds for the distribution of the run length of geometric moving average
charts, Appl. Statist. 35, 151-158.
See Also
xewma.arl for zero-state ARL computation of EWMA control charts.
Examples
## Gan (1993), two-sided EWMA with fixed control limits
## some values of his Table 1 -- any median RL should be 500
for ( i in 1:length(G.lambda) ) {
SF <- xewma.sf(G.lambda[i], G.h[i], 0, 1000)
if (i==1) plot(1:length(SF), SF, type="l", xlab="n", ylab="P(L>n)")
else lines(1:length(SF), SF, col=i)
}
xewma.sf.prerun 91
xewma.sf.prerun Compute the survival function of EWMA run length in case of esti-
mated parameters
Description
Computation of the survival function of the Run Length (RL) for EWMA control charts monitoring
normal mean if the in-control mean, standard deviation, or both are estimated by a pre run.
Usage
xewma.sf.prerun(l, c, mu, n, zr=0, hs=0, sided="one", limits="fix", q=1,
size=100, df=NULL, estimated="mu", qm.mu=30, qm.sigma=30,
truncate=1e-10, tail_approx=TRUE, bound=1e-10)
Arguments
l smoothing parameter lambda of the EWMA control chart.
c critical value (similar to alarm limit) of the EWMA control chart.
mu true mean.
n calculate sf up to value n.
zr reflection border for the one-sided chart.
hs so-called headstart (give fast initial response).
sided distinguish between one- and two-sided EWMA control chart by choosing "one"
and "two", respectively.
limits distinguish between different control limits behavior.
q change point position. For q = 1 and µ = µ0 and µ = µ1 , the usual zero-state
situation for the in-control and out-of-control case, respectively, are calculated.
Note that mu0=0 is implicitely fixed.
size pre run sample size.
df degrees of freedom of the pre run variance estimator. Typically it is simply size
- 1. If the pre run is collected in batches, then also other values are needed.
estimated name the parameter to be estimated within the "mu", "sigma", "both".
qm.mu number of quadrature nodes for convoluting the mean uncertainty.
qm.sigma number of quadrature nodes for convoluting the standard deviation uncertainty.
truncate size of truncated tail.
tail_approx Controls whether the geometric tail approximation is used (is faster) or not.
bound control when the geometric tail kicks in; the larger the quicker and less accurate;
bound should be larger than 0 and less than 0.001.
92 xewma.sf.prerun
Details
The survival function P(L>n) and derived from it also the cdf P(L<=n) and the pmf P(L=n) illustrate
the distribution of the EWMA run length...
Value
Returns a vector which resembles the survival function up to a certain point.
Author(s)
Sven Knoth
References
F. F. Gan (1993), An optimal design of EWMA control charts based on the median run length, J.
Stat. Comput. Simulation 45, 169-184.
S. Knoth (2003), EWMA schemes with non-homogeneous transition kernels, Sequential Analysis
22, 241-255.
S. Knoth (2004), Fast initial response features for EWMA Control Charts, Statistical Papers 46,
47-64.
L. A. Jones, C. W. Champ, S. E. Rigdon (2001), The performance of exponentially weighted moving
average charts with estimated parameters, Technometrics 43, 156-167.
K.-H. Waldmann (1986), Bounds for the distribution of the run length of geometric moving average
charts, Appl. Statist. 35, 151-158.
See Also
xewma.sf for the RL survival function of EWMA control charts w/o pre run uncertainty.
Examples
## Jones/Champ/Rigdon (2001)
Description
Computation of the steady-state Average Run Length (ARL) for Shiryaev-Roberts schemes moni-
toring normal mean.
Usage
xgrsr.ad(k, g, mu1, mu0 = 0, zr = 0, sided = "one", MPT = FALSE, r = 30)
Arguments
k reference value of the Shiryaev-Roberts scheme.
g control limit (alarm threshold) of Shiryaev-Roberts scheme.
mu1 out-of-control mean.
mu0 in-control mean.
zr reflection border to enable the numerical algorithms used here.
sided distinguishes between one- and two-sided schemes by choosing "one" and"two",
respectively. Currently only one-sided schemes are implemented.
MPT switch between the old implementation (FALSE) and the new one (TRUE) that
considers the completed likelihood ratio. MPT contains the initials of G. Mous-
takides, A. Polunchenko and A. Tartakovsky.
r number of quadrature nodes, dimension of the resulting linear equation system
is equal to r+1.
Details
xgrsr.ad determines the steady-state Average Run Length (ARL) by numerically solving the re-
lated ARL integral equation by means of the Nystroem method based on Gauss-Legendre quadra-
ture.
94 xgrsr.ad
Value
Returns a single value which resembles the steady-state ARL.
Author(s)
Sven Knoth
References
S. Knoth (2006), The art of evaluating monitoring schemes – how to measure the performance of
control charts? S. Lenz, H. & Wilrich, P. (ed.), Frontiers in Statistical Quality Control 8, Physica
Verlag, Heidelberg, Germany, 74-99.
G. Moustakides, A. Polunchenko, A. Tartakovsky (2009), Numerical comparison of CUSUM and
Shiryaev-Roberts procedures for detectin changes in distributions, Communications in Statistics:
Theory and Methods 38, 3225-3239.
See Also
xewma.arl and xcusum-arl for zero-state ARL computation of EWMA and CUSUM control
charts, respectively, and xgrsr.arl for the zero-state ARL.
Examples
## Small study to identify appropriate reflection border to mimic unreflected schemes
k <- .5
g <- log(390)
zrs <- -(0:10)
ZRxgrsr.ad <- Vectorize(xgrsr.ad, "zr")
ads <- ZRxgrsr.ad(k, g, 0, zr=zrs)
data.frame(zrs, ads)
Description
Computation of the (zero-state) Average Run Length (ARL) for Shiryaev-Roberts schemes moni-
toring normal mean.
Usage
xgrsr.arl(k, g, mu, zr = 0, hs=NULL, sided = "one", q = 1, MPT = FALSE, r = 30)
Arguments
k reference value of the Shiryaev-Roberts scheme.
g control limit (alarm threshold) of Shiryaev-Roberts scheme.
mu true mean.
zr reflection border to enable the numerical algorithms used here.
hs so-called headstart (enables fast initial response). If hs=NULL, then the classical
headstart -Inf is used (corresponds to 0 for the non-log scheme).
sided distinguishes between one- and two-sided schemes by choosing "one" and"two",
respectively. Currently only one-sided schemes are implemented.
q change point position. For q = 1 and µ = µ0 and µ = µ1 , the usual zero-state
ARLs for the in-control and out-of-control case, respectively, are calculated. For
q > 1 and µ! = 0 conditional delays, that is, Eq (L − q + 1|L ≥ q), will be
determined. Note that mu0=0 is implicitely fixed.
MPT switch between the old implementation (FALSE) and the new one (TRUE) that
considers the complete likelihood ratio. MPT stands for the initials of G. Mous-
takides, A. Polunchenko and A. Tartakovsky.
r number of quadrature nodes, dimension of the resulting linear equation system
is equal to r+1.
96 xgrsr.arl
Details
xgrsr.arl determines the Average Run Length (ARL) by numerically solving the related ARL
integral equation by means of the Nystroem method based on Gauss-Legendre quadrature.
Value
Returns a vector of length q which resembles the ARL and the sequence of conditional expected
delays for q=1 and q>1, respectively.
Author(s)
Sven Knoth
References
S. Knoth (2006), The art of evaluating monitoring schemes – how to measure the performance of
control charts? S. Lenz, H. & Wilrich, P. (ed.), Frontiers in Statistical Quality Control 8, Physica
Verlag, Heidelberg, Germany, 74-99.
G. Moustakides, A. Polunchenko, A. Tartakovsky (2009), Numerical comparison of CUSUM and
Shiryaev-Roberts procedures for detecting changes in distributions, Communications in Statistics:
Theory and Methods 38, 3225-3239.
See Also
xewma.arl and xcusum-arl for zero-state ARL computation of EWMA and CUSUM control
charts, respectively, and xgrsr.ad for the steady-state ARL.
Examples
## Small study to identify appropriate reflection border to mimic unreflected schemes
k <- .5
g <- log(390)
zrs <- -(0:10)
ZRxgrsr.arl <- Vectorize(xgrsr.arl, "zr")
arls <- ZRxgrsr.arl(k, g, 0, zr=zrs)
data.frame(zrs, arls)
theta <- .1
As2 <- c(47.17, 94.34, 471.7, 943.41, 4717.04, 9434.08)
gs2 <- log(As2)
arls0 <- round(XGRSR.arl(theta/2, gs2, 0, zr=-5, r=300, MPT=TRUE), digits=2)
arls1 <- round(XGRSR.arl(theta/2, gs2, theta, zr=-5, r=300, MPT=TRUE), digits=2)
data.frame(As2, arls0, arls1)
theta <- .5
As3 <- c(37.38, 74.76, 373.81, 747.62, 3738.08, 7476.15)
gs3 <- log(As3)
arls0 <- round(XGRSR.arl(theta/2, gs3, 0, zr=-5, r=70, MPT=TRUE), digits=2)
arls1 <- round(XGRSR.arl(theta/2, gs3, theta, zr=-5, r=70, MPT=TRUE), digits=2)
data.frame(As3, arls0, arls1)
theta <- 1
As4 <- c(28.02, 56.04, 280.19, 560.37, 2801.85, 5603.7)
gs4 <- log(As4)
arls0 <- round(XGRSR.arl(theta/2, gs4, 0, zr=-6, r=40, MPT=TRUE), digits=2)
arls1 <- round(XGRSR.arl(theta/2, gs4, theta, zr=-6, r=40, MPT=TRUE), digits=2)
data.frame(As4, arls0, arls1)
Description
Computation of the alarm thresholds (alarm limits) for Shiryaev-Roberts schemes monitoring nor-
mal mean.
Usage
xgrsr.crit(k, L0, mu0 = 0, zr = 0, hs = NULL, sided = "one", MPT = FALSE, r = 30)
Arguments
k reference value of the Shiryaev-Roberts scheme.
L0 in-control ARL.
mu0 in-control mean.
zr reflection border to enable the numerical algorithms used here.
hs so-called headstart (enables fast initial response). If hs=NULL, then the classical
headstart -Inf is used (corresponds to 0 for the non-log scheme).
sided distinguishes between one- and two-sided schemes by choosing "one" and"two",
respectively. Currently only one-sided schemes are implemented.
MPT switch between the old implementation (FALSE) and the new one (TRUE) that
considers the completed likelihood ratio. MPT contains the initials of G. Mous-
takides, A. Polunchenko and A. Tartakovsky.
r number of quadrature nodes, dimension of the resulting linear equation system
is equal to r+1.
Details
xgrsr.crit determines the alarm threshold (alarm limit) for given in-control ARL L0 by applying
secant rule and using xgrsr.arl().
Value
Returns a single value which resembles the alarm limit g.
Author(s)
Sven Knoth
xsewma.arl 99
References
G. Moustakides, A. Polunchenko, A. Tartakovsky (2009), Numerical comparison of CUSUM and
Shiryaev-Roberts procedures for detecting changes in distributions, Communications in Statistics:
Theory and Methods 38, 3225-3239.r.
See Also
xgrsr.arl for zero-state ARL computation.
Examples
## Table 4 from Moustakides et al. (2009)
## original values are
# gamma/L0 A/exp(g)
# 50 28.02
# 100 56.04
# 500 280.19
# 1000 560.37
# 5000 2801.75
# 10000 5603.7
theta <- 1
zr <- -6
r <- 100
Lxgrsr.crit <- Vectorize("xgrsr.crit", "L0")
L0s <- c(50, 100, 500, 1000, 5000, 10000)
gs <- Lxgrsr.crit(theta/2, L0s, zr=zr, r=r)
data.frame(L0s, gs, A=round(exp(gs), digits=2))
xsewma.arl Compute ARLs of simultaneous EWMA control charts (mean and vari-
ance charts)
Description
Computation of the (zero-state) Average Run Length (ARL) for different types of simultaneous
EWMA control charts (based on the sample mean and the sample variance S 2 ) monitoring normal
mean and variance.
Usage
xsewma.arl(lx, cx, ls, csu, df, mu, sigma, hsx=0, Nx=40, csl=0,
hss=1, Ns=40, s2.on=TRUE, sided="upper", qm=30)
Arguments
lx smoothing parameter lambda of the two-sided mean EWMA chart.
cx control limit of the two-sided mean EWMA control chart.
ls smoothing parameter lambda of the variance EWMA chart.
100 xsewma.arl
Details
xsewma.arl determines the Average Run Length (ARL) by an extension of Gan’s (derived from
ideas already published by Waldmann) algorithm. The variance EWMA part is treated similarly to
the ARL calculation method deployed for the single variance EWMA charts in Knoth (2005), that
is, by means of collocation (Chebyshev polynomials). For more details see Knoth (2007).
Value
Returns a single value which resembles the ARL.
Author(s)
Sven Knoth
References
K. Waldmann (1986), Bounds for the distribution of the run length of geometric moving average
charts, J. R. Stat. Soc., Ser. C, Appl. Stat. 35, 151-158.
F. F. Gan (1995), Joint monitoring of process mean and variance using exponentially weighted
moving average control charts, Technometrics 37, 446-453.
S. Knoth (2005), Accurate ARL computation for EWMA-S 2 control charts, Statistics and Comput-
ing 15, 341-352.
S. Knoth (2007), Accurate ARL calculation for EWMA control charts monitoring simultaneously
normal mean and variance, Sequential Analysis 26, 251-264.
xsewma.crit 101
See Also
xewma.arl and sewma.arl for zero-state ARL computation of single mean and variance EWMA
control charts, respectively.
Examples
## Knoth (2007)
## collocation results in Table 1
## Monte Carlo with 10^9 replicates: 252.307 +/- 0.0078
# process parameters
mu <- 0
sigma <- 1
# subgroup size n=5, df=n-1
df <- 4
# lambda of mean chart
lx <- .134
# c_mu^* = .345476571 = cx/sqrt(n) * sqrt(lx/(2-lx)
cx <- .345476571*sqrt(df+1)/sqrt(lx/(2-lx))
# lambda of variance chart
ls <- .1
# c_sigma = .477977
csu <- 1 + .477977
# matrix dimensions for mean and variance part
Nx <- 25
Ns <- 25
# mode of variance chart
SIDED <- "upper"
arl <- xsewma.arl(lx, cx, ls, csu, df, mu, sigma, Nx=Nx, Ns=Ns, sided=SIDED)
arl
Description
Computation of the critical values (similar to alarm limits) for different types of simultaneous
EWMA control charts (based on the sample mean and the sample variance S 2 ) monitoring nor-
mal mean and variance.
Usage
Arguments
lx smoothing parameter lambda of the two-sided mean EWMA chart.
ls smoothing parameter lambda of the variance EWMA chart.
L0 in-control ARL.
mu0 in-control mean.
sigma0 in-control standard deviation.
cu for two-sided (sided="two") and fixed upper control limit (mode="fixed") a
value larger than sigma0 has to been given, for all other cases cu is ignored.
hsx so-called headstart (enables fast initial response) of the mean chart – do not
confuse with the true FIR feature considered in xewma.arl; will be updated.
hss headstart (enables fast initial response) of the variance chart.
df actual degrees of freedom, corresponds to subgroup size (for known mean it is
equal to the subgroup size, for unknown mean it is equal to subgroup size minus
one.
s2.on distinguishes between S 2 and S chart.
sided distinguishes between one- and two-sided two-sided EWMA-S 2 control charts
by choosing "upper" (upper chart without reflection at cl – the actual value of
cl is not used), "Rupper" (upper chart with reflection at cl), "Rlower" (lower
chart with reflection at cu), and "two" (two-sided chart), respectively.
mode only deployed for sided="two" – with "fixed" an upper control limit (see
cu) is set and only the lower is determined to obtain the in-control ARL L0,
while with "unbiased" a certain unbiasedness of the ARL function is guaran-
teed (here, both the lower and the upper control limit are calculated).
Nx dimension of the approximating matrix of the mean chart.
Ns dimension of the approximating matrix of the variance chart.
qm number of quadrature nodes used for the collocation integrals.
Details
xsewma.crit determines the critical values (similar to alarm limits) for given in-control ARL L0
by applying secant rule and using xsewma.arl(). In case of sided="two" and mode="unbiased"
a two-dimensional secant rule is applied that also ensures that the maximum of the ARL function
for given standard deviation is attained at sigma0. See Knoth (2007) for details and application.
Value
Returns the critical value of the two-sided mean EWMA chart and the lower and upper controls
limit cl and cu of the variance EWMA chart.
Author(s)
Sven Knoth
xsewma.q 103
References
S. Knoth (2007), Accurate ARL calculation for EWMA control charts monitoring simultaneously
normal mean and variance, Sequential Analysis 26, 251-264.
See Also
xsewma.arl for calculation of ARL of simultaneous EWMA charts.
Examples
## Knoth (2007)
## results in Table 2
Description
Computation of the critical values (similar to alarm limits) for different types of simultaneous
EWMA control charts (based on the sample mean and the sample variance S 2 ) monitoring nor-
mal mean and variance.
Usage
xsewma.q(lx, cx, ls, csu, df, alpha, mu, sigma, hsx=0,
Nx=40, csl=0, hss=1, Ns=40, sided="upper", qm=30)
104 xsewma.q
Arguments
lx smoothing parameter lambda of the two-sided mean EWMA chart.
cx control limit of the two-sided mean EWMA control chart.
ls smoothing parameter lambda of the variance EWMA chart.
csu for two-sided (sided="two") and fixed upper control limit (mode="fixed",
only for xsewma.q.crit) a value larger than sigma0 has to been given, for all
other cases cu is ignored. It is the upper control limit of the variance EWMA
control chart.
L0 in-control RL quantile at level alpha.
df actual degrees of freedom, corresponds to subgroup size (for known mean it is
equal to the subgroup size, for unknown mean it is equal to subgroup size minus
one.
alpha quantile level.
mu true mean.
sigma true standard deviation.
mu0 in-control mean.
sigma0 in-control standard deviation.
hsx so-called headstart (enables fast initial response) of the mean chart – do not
confuse with the true FIR feature considered in xewma.arl; will be updated.
Nx dimension of the approximating matrix of the mean chart.
csl lower control limit of the variance EWMA control chart; default value is 0; not
considered if sided is "upper".
hss headstart (enables fast initial response) of the variance chart.
Ns dimension of the approximating matrix of the variance chart.
sided distinguishes between one- and two-sided two-sided EWMA-S 2 control charts
by choosing "upper" (upper chart without reflection at cl – the actual value of
of cl is not used).
mode only deployed for sided="two" – with "fixed" an upper control limit (see
cu) is set and only the lower is determined to obtain the in-control ARL L0,
while with "unbiased" a certain unbiasedness of the ARL function is guaran-
teed (here, both the lower and the upper control limit are calculated).
qm number of quadrature nodes used for the collocation integrals.
c.error error bound for two succeeding values of the critical value during applying the
secant rule.
a.error error bound for the quantile level alpha during applying the secant rule.
xsewma.sf 105
Details
Instead of the popular ARL (Average Run Length) quantiles of the EWMA stopping time (Run
Length) are determined. The algorithm is based on Waldmann’s survival function iteration proce-
dure and on Knoth (2007). xsewma.q.crit determines the critical values (similar to alarm limits)
for given in-control RL quantile L0 at level alpha by applying secant rule and using xsewma.sf().
In case of sided="two" and mode="unbiased" a two-dimensional secant rule is applied that also
ensures that the maximum of the RL cdf for given standard deviation is attained at sigma0.
Value
Returns a single value which resembles the RL quantile of order alpha and the critical value of the
two-sided mean EWMA chart and the lower and upper controls limit csl and csu of the variance
EWMA chart, respectively.
Author(s)
Sven Knoth
References
S. Knoth (2007), Accurate ARL calculation for EWMA control charts monitoring simultaneously
normal mean and variance, Sequential Analysis 26, 251-264.
See Also
xsewma.arl for calculation of ARL of simultaneous EWMA charts and xsewma.sf for the RL
survival function.
Examples
## Knoth (2014?)
Description
Computation of the survival function of the Run Length (RL) for EWMA control charts monitoring
simultaneously normal mean and variance.
Usage
xsewma.sf(n, lx, cx, ls, csu, df, mu, sigma, hsx=0, Nx=40,
csl=0, hss=1, Ns=40, sided="upper", qm=30)
106 xsewma.sf
Arguments
n calculate sf up to value n.
lx smoothing parameter lambda of the two-sided mean EWMA chart.
cx control limit of the two-sided mean EWMA control chart.
ls smoothing parameter lambda of the variance EWMA chart.
csu upper control limit of the variance EWMA control chart.
df actual degrees of freedom, corresponds to subgroup size (for known mean it is
equal to the subgroup size, for unknown mean it is equal to subgroup size minus
one.
mu true mean.
sigma true standard deviation.
hsx so-called headstart (enables fast initial response) of the mean chart – do not
confuse with the true FIR feature considered in xewma.arl; will be updated.
Nx dimension of the approximating matrix of the mean chart.
csl lower control limit of the variance EWMA control chart; default value is 0; not
considered if sided is "upper".
hss headstart (enables fast initial response) of the variance chart.
Ns dimension of the approximating matrix of the variance chart.
sided distinguishes between one- and two-sided two-sided EWMA-S 2 control charts
by choosing "upper" (upper chart without reflection at cl – the actual value of
cl is not used), "Rupper" (upper chart with reflection at cl), "Rlower" (lower
chart with reflection at cu), and "two" (two-sided chart), respectively.
qm number of quadrature nodes used for the collocation integrals.
Details
The survival function P(L>n) and derived from it also the cdf P(L<=n) and the pmf P(L=n) illustrate
the distribution of the EWMA run length. For large n the geometric tail could be exploited. That
is, with reasonable large n the complete distribution is characterized. The algorithm is based on
Waldmann’s survival function iteration procedure and on results in Knoth (2007).
Value
Returns a vector which resembles the survival function up to a certain point.
Author(s)
Sven Knoth
References
S. Knoth (2007), Accurate ARL calculation for EWMA control charts monitoring simultaneously
normal mean and variance, Sequential Analysis 26, 251-264.
K.-H. Waldmann (1986), Bounds for the distribution of the run length of geometric moving average
charts, Appl. Statist. 35, 151-158.
xshewhart.ar1.arl 107
See Also
xsewma.arl for zero-state ARL computation of simultaneous EWMA control charts.
Examples
## Knoth (2014?)
xshewhart.ar1.arl Compute ARLs of modified Shewhart control charts for AR(1) data
Description
Computation of the (zero-state) Average Run Length (ARL) for modified Shewhart charts deployed
to the original AR(1) data.
Usage
xshewhart.ar1.arl(alpha, cS, delta=0, N1=50, N2=30)
Arguments
alpha lag 1 correlation of the data.
cS critical value (alias to alarm limit) of the Shewhart control chart.
delta potential shift in the data (in-control mean is zero.
N1 number of quadrature nodes for solving the ARL integral equation, dimension
of the resulting linear equation system is N1.
N2 second number of quadrature nodes for combining the probability density func-
tion of the first observation following the margin distribution and the solution of
the ARL integral equation.
Details
Following the idea of Schmid (1995), 1- alpha times the data turns out to be an EWMA smoothing
of the underlying AR(1) residuals. Hence, by combining the solution of the EWMA ARL integral
equation and the stationary distribution of the AR(1) data (normal distribution is assumed) one gets
easily the overall ARL.
Value
It returns a single value resembling the zero-state ARL of a modified Shewhart chart.
Author(s)
Sven Knoth
108 xshewhartrunsrules.arl
References
S. Knoth, W. Schmid (2004). Control charts for time series: A review. In Frontiers in Statistical
Quality Control 7, edited by H.-J. Lenz, P.-T. Wilrich, 210-236, Physica-Verlag.
H. Kramer, W. Schmid (2000). The influence of parameter estimation on the ARL of Shewhart type
charts for time series. Statistical Papers 41(2), 173-196.
W. Schmid (1995). On the run length of a Shewhart chart for correlated data. Statistical Papers
36(1), 111-130.
See Also
xewma.arl for zero-state ARL computation of EWMA control charts.
Examples
## Table 1 in Kramer/Schmid (2000)
cS <- 3.09023
a <- seq(0, 4, by=.5)
row1 <- row2 <- row3 <- NULL
for ( i in 1:length(a) ) {
row1 <- c(row1, round(xshewhart.ar1.arl( 0.4, cS, delta=a[i]), digits=2))
row2 <- c(row2, round(xshewhart.ar1.arl( 0.2, cS, delta=a[i]), digits=2))
row3 <- c(row3, round(xshewhart.ar1.arl(-0.2, cS, delta=a[i]), digits=2))
}
xshewhartrunsrules.arl
Compute ARLs of Shewhart control charts with and without runs rules
Description
Computation of the (zero-state and steady-state) Average Run Length (ARL) for Shewhart control
charts with and without runs rules monitoring normal mean.
Usage
xshewhartrunsrules.arl(mu, c = 1, type = "12")
Arguments
mu true mean.
L0 pre-defined in-control ARL, that is, determine c so that the mean number of
observations until a false alarm is L0.
mu1, mu0 for the steady-state ARL two means are specified, mu0 is the in-control one and
usually equal to 0 , and mu1 must be given.
c normalizing constant to ensure specific alarming behavior.
type controls the type of Shewhart chart used, seed details section.
Details
xshewhartrunsrules.arl determines the zero-state Average Run Length (ARL) based on the
Markov chain approach given in Champ and Woodall (1987). xshewhartrunsrules.matrix pro-
vides the corresponding transition matrix that is also used in xDshewhartrunsrules.arl (ARL for
control charting drift). xshewhartrunsrules.crit allows to find the normalization constant c to
attain a fixed in-control ARL. Typically this is needed to calibrate the chart. With xshewhartrunsrules.ad
the steady-state ARL is calculated. With the argument type certain runs rules could be set. The
following list gives an overview.
• "1" The classical Shewhart chart with +/- 3 c sigma control limits (c is typically equal to 1
and can be changed by the argument c).
• "12" The classic and the following runs rule: 2 of 3 are beyond +/- 2 c sigma on the same
side of the chart.
• "13" The classic and the following runs rule: 4 of 5 are beyond +/- 1 c sigma on the same
side of the chart.
• "14" The classic and the following runs rule: 8 of 8 are on the same side of the chart (referring
to the center line).
Value
Returns a single value which resembles the zero-state or steady-state ARL. xshewhartrunsrules.matrix
returns a matrix.
Author(s)
Sven Knoth
References
C. W. Champ and W. H. Woodall (1987), Exact results for Shewhart control charts with supplemen-
tary runs rules, Technometrics 29, 393-399.
110 xshewhartrunsrules.arl
See Also
xDshewhartrunsrules.arl for zero-state ARL of Shewhart control charts with or without runs
rules under drift.
Examples
## Champ/Woodall (1987)
## Table 1
mus <- (0:15)/5
Mxshewhartrunsrules.arl <- Vectorize(xshewhartrunsrules.arl, "mu")
# standard (1 of 1 beyond 3 sigma) Shewhart chart without runs rules
C1 <- round(Mxshewhartrunsrules.arl(mus, type="1"), digits=2)
# standard + runs rule: 2 of 3 beyond 2 sigma on the same side
C12 <- round(Mxshewhartrunsrules.arl(mus, type="12"), digits=2)
# standard + runs rule: 4 of 5 beyond 1 sigma on the same side
C13 <- round(Mxshewhartrunsrules.arl(mus, type="13"), digits=2)
# standard + runs rule: 8 of 8 on the same side of the center line
C14 <- round(Mxshewhartrunsrules.arl(mus, type="14"), digits=2)
Description
Computation of the (zero-state) Average Run Length (ARL) for different types of CUSUM control
charts monitoring normal mean.
Usage
xtcusum.arl(k, h, df, mu, hs = 0, sided="one", mode="tan", r=30)
Arguments
k reference value of the CUSUM control chart.
h decision interval (alarm limit, threshold) of the CUSUM control chart.
df degrees of freedom – parameter of the t distribution.
mu true mean.
hs so-called headstart (give fast initial response).
sided distinguish between one- and two-sided CUSUM schemes by choosing "one"
and "two", respectively.
r number of quadrature nodes, dimension of the resulting linear equation system
is equal to r+1.
mode Controls the type of variables substitution that might improve the numerical
performance. Currently, "identity", "sin", "sinh", and "tan" (default) are
provided.
Details
xtcusum.arl determines the Average Run Length (ARL) by numerically solving the related ARL
integral equation by means of the Nystroem method based on Gauss-Legendre quadrature.
Value
Returns a single value which resembles the ARL.
Author(s)
Sven Knoth
112 xtewma.ad
References
A. L. Goel, S. M. Wu (1971), Determination of A.R.L. and a contour nomogram for CUSUM charts
to control normal mean, Technometrics 13, 221-230.
D. Brook, D. A. Evans (1972), An approach to the probability distribution of cusum run length,
Biometrika 59, 539-548.
J. M. Lucas, R. B. Crosier (1982), Fast initial response for cusum quality-control schemes: Give
your cusum a headstart, Technometrics 24, 199-205.
L. C. Vance (1986), Average run lengths of cumulative sum control charts for controlling normal
means, Journal of Quality Technology 18, 189-193.
K.-H. Waldmann (1986), Bounds for the distribution of the run length of one-sided and two-sided
CUSUM quality control schemes, Technometrics 28, 61-67.
R. B. Crosier (1986), A new two-sided cumulative quality control scheme, Technometrics 28, 187-
194.
See Also
xtewma.arl for zero-state ARL computation of EWMA control charts and xtcusum.arl for the
zero-state ARL of CUSUM for normal data.
Examples
## will follow
Description
Computation of the steady-state Average Run Length (ARL) for different types of EWMA control
charts monitoring the mean of t distributed data.
Usage
xtewma.ad(l, c, df, mu1, mu0=0, zr=0, z0=0, sided="one", limits="fix",
steady.state.mode="conditional", mode="tan", r=40)
Arguments
l smoothing parameter lambda of the EWMA control chart.
c critical value (similar to alarm limit) of the EWMA control chart.
df degrees of freedom – parameter of the t distribution.
mu1 in-control mean.
mu0 out-of-control mean.
zr reflection border for the one-sided chart.
xtewma.ad 113
Details
xtewma.ad determines the steady-state Average Run Length (ARL) by numerically solving the
related ARL integral equation by means of the Nystroem method based on Gauss-Legendre quadra-
ture and using the power method for deriving the largest in magnitude eigenvalue and the related
left eigenfunction.
Value
Returns a single value which resembles the steady-state ARL.
Author(s)
Sven Knoth
References
R. B. Crosier (1986), A new two-sided cumulative quality control scheme, Technometrics 28, 187-
194.
S. V. Crowder (1987), A simple method for studying run-length distributions of exponentially
weighted moving average charts, Technometrics 29, 401-407.
J. M. Lucas and M. S. Saccucci (1990), Exponentially weighted moving average control schemes:
Properties and enhancements, Technometrics 32, 1-12.
See Also
xtewma.arl for zero-state ARL computation and xewma.ad for the steady-state ARL for normal
data.
Examples
## will follow
114 xtewma.arl
Description
Computation of the (zero-state) Average Run Length (ARL) for different types of EWMA control
charts monitoring the mean of t distributed data.
Usage
xtewma.arl(l,c,df,mu,zr=0,hs=0,sided="two",limits="fix",mode="tan",q=1,r=40)
Arguments
l smoothing parameter lambda of the EWMA control chart.
c critical value (similar to alarm limit) of the EWMA control chart.
df degrees of freedom – parameter of the t distribution.
mu true mean.
zr reflection border for the one-sided chart.
hs so-called headstart (enables fast initial response).
sided distinguishes between one- and two-sided EWMA control chart by choosing
"one" and "two", respectively.
limits distinguishes between different control limits behavior.
mode Controls the type of variables substitution that might improve the numerical
performance. Currently, "identity", "sin", "sinh", and "tan" (default) are
provided.
q change point position. For q = 1 and µ = µ0 and µ = µ1 , the usual zero-state
ARLs for the in-control and out-of-control case, respectively, are calculated. For
q > 1 and µ! = 0 conditional delays, that is, Eq (L − q + 1|L ≥ q), will be
determined. Note that mu0=0 is implicitely fixed.
r number of quadrature nodes, dimension of the resulting linear equation system
is equal to r+1 (one-sided) or r (two-sided).
Details
In case of the EWMA chart with fixed control limits, xtewma.arl determines the Average Run
Length (ARL) by numerically solving the related ARL integral equation by means of the Nystroem
method based on Gauss-Legendre quadrature. If limits is "vacl", then the method presented in
Knoth (2003) is utilized. Other values (normal case) for limits are not yet supported.
Value
Except for the fixed limits EWMA charts it returns a single value which resembles the ARL. For
fixed limits charts, it returns a vector of length q which resembles the ARL and the sequence of
conditional expected delays for q=1 and q>1, respectively.
xtewma.q 115
Author(s)
Sven Knoth
References
K.-H. Waldmann (1986), Bounds for the distribution of the run length of geometric moving average
charts, Appl. Statist. 35, 151-158.
S. V. Crowder (1987), A simple method for studying run-length distributions of exponentially
weighted moving average charts, Technometrics 29, 401-407.
J. M. Lucas and M. S. Saccucci (1990), Exponentially weighted moving average control schemes:
Properties and enhancements, Technometrics 32, 1-12.
C. M. Borror, D. C. Montgomery, and G. C. Runger (1999), Robustness of the EWMA control chart
to non-normality , Journal of Quality Technology 31, 309-316.
S. Knoth (2003), EWMA schemes with non-homogeneous transition kernels, Sequential Analysis
22, 241-255.
S. Knoth (2004), Fast initial response features for EWMA Control Charts, Statistical Papers 46,
47-64.
See Also
xewma.arl for zero-state ARL computation of EWMA control charts in the normal case.
Examples
## Borror/Montgomery/Runger (1999), Table 3
lambda <- 0.1
cE <- 2.703
df <- c(4, 6, 8, 10, 15, 20, 30, 40, 50)
L0 <- rep(NA, length(df))
for ( i in 1:length(df) ) {
L0[i] <- round(xtewma.arl(lambda, cE*sqrt(df[i]/(df[i]-2)), df[i], 0), digits=0)
}
data.frame(df, L0)
Description
Computation of quantiles of the Run Length (RL) for EWMA control charts monitoring normal
mean.
116 xtewma.q
Usage
xtewma.q(l, c, df, mu, alpha, zr=0, hs=0, sided="two", limits="fix", mode="tan",
q=1, r=40)
xtewma.q.crit(l, L0, df, mu, alpha, zr=0, hs=0, sided="two", limits="fix", mode="tan",
r=40, c.error=1e-12, a.error=1e-9, OUTPUT=FALSE)
Arguments
l smoothing parameter lambda of the EWMA control chart.
c critical value (similar to alarm limit) of the EWMA control chart.
df degrees of freedom – parameter of the t distribution.
mu true mean.
alpha quantile level.
zr reflection border for the one-sided chart.
hs so-called headstart (enables fast initial response).
sided distinguishes between one- and two-sided EWMA control chart by choosing
"one" and "two", respectively.
limits distinguishes between different control limits behavior.
mode Controls the type of variables substitution that might improve the numerical
performance. Currently, "identity", "sin", "sinh", and "tan" (default) are
provided.
q change point position. For q = 1 and µ = µ0 and µ = µ1 , the usual zero-state
ARLs for the in-control and out-of-control case, respectively, are calculated.
For q > 1 and µ! = 0 conditional delays, that is, Eq (L − q + 1|L ≥), will be
determined. Note that mu0=0 is implicitely fixed.
r number of quadrature nodes, dimension of the resulting linear equation system
is equal to r+1 (one-sided) or r (two-sided).
L0 in-control quantile value.
c.error error bound for two succeeding values of the critical value during applying the
secant rule.
a.error error bound for the quantile level alpha during applying the secant rule.
OUTPUT activate or deactivate additional output.
Details
Instead of the popular ARL (Average Run Length) quantiles of the EWMA stopping time (Run
Length) are determined. The algorithm is based on Waldmann’s survival function iteration proce-
dure. If limits is "vacl", then the method presented in Knoth (2003) is utilized. For details see
Knoth (2004).
Value
Returns a single value which resembles the RL quantile of order q.
xtewma.sf 117
Author(s)
Sven Knoth
References
F. F. Gan (1993), An optimal design of EWMA control charts based on the median run length, J.
Stat. Comput. Simulation 45, 169-184.
S. Knoth (2003), EWMA schemes with non-homogeneous transition kernels, Sequential Analysis
22, 241-255.
S. Knoth (2004), Fast initial response features for EWMA Control Charts, Statistical Papers 46,
47-64.
K.-H. Waldmann (1986), Bounds for the distribution of the run length of geometric moving average
charts, Appl. Statist. 35, 151-158.
See Also
xewma.q for RL quantile computation of EWMA control charts in the normal case.
Examples
## will follow
Description
Computation of the survival function of the Run Length (RL) for EWMA control charts monitoring
normal mean.
Usage
xtewma.sf(l, c, df, mu, n, zr=0, hs=0, sided="two", limits="fix", mode="tan", q=1, r=40)
Arguments
l smoothing parameter lambda of the EWMA control chart.
c critical value (similar to alarm limit) of the EWMA control chart.
df degrees of freedom – parameter of the t distribution.
mu true mean.
n calculate sf up to value n.
zr reflection border for the one-sided chart.
hs so-called headstart (enables fast initial response).
118 xtewma.sf
sided distinguishes between one- and two-sided EWMA control chart by choosing
"one" and "two", respectively.
limits distinguishes between different conrol limits behavior.
mode Controls the type of variables substitution that might improve the numerical
performance. Currently, "identity", "sin", "sinh", and "tan" (default) are
provided.
q change point position. For q = 1 and µ = µ0 and µ = µ1 , the usual zero-state
situation for the in-control and out-of-control case, respectively, are calculated.
Note that mu0=0 is implicitely fixed.
r number of quadrature nodes, dimension of the resulting linear equation system
is equal to r+1 (one-sided) or r (two-sided).
Details
The survival function P(L>n) and derived from it also the cdf P(L<=n) and the pmf P(L=n) illustrate
the distribution of the EWMA run length. For large n the geometric tail could be exploited. That
is, with reasonable large n the complete distribution is characterized. The algorithm is based on
Waldmann’s survival function iteration procedure. For varying limits and for change points after 1
the algorithm from Knoth (2004) is applied. For details see Knoth (2004).
Value
Returns a vector which resembles the survival function up to a certain point.
Author(s)
Sven Knoth
References
F. F. Gan (1993), An optimal design of EWMA control charts based on the median run length, J.
Stat. Comput. Simulation 45, 169-184.
S. Knoth (2003), EWMA schemes with non-homogeneous transition kernels, Sequential Analysis
22, 241-255.
S. Knoth (2004), Fast initial response features for EWMA Control Charts, Statistical Papers 46,
47-64.
K.-H. Waldmann (1986), Bounds for the distribution of the run length of geometric moving average
charts, Appl. Statist. 35, 151-158.
See Also
xewma.sf for survival function computation of EWMA control charts in the normal case.
Examples
## will follow
xtshewhart.ar1.arl 119
xtshewhart.ar1.arl Compute ARLs of modified Shewhart control charts for AR(1) data
with Student t residuals
Description
Computation of the (zero-state) Average Run Length (ARL) for modified Shewhart charts deployed
to the original AR(1) data where the residuals follow a Student t distribution.
Usage
xtshewhart.ar1.arl(alpha, cS, df, delta=0, N1=50, N2=30, N3=2*N2, INFI=10, mode="tan")
Arguments
alpha lag 1 correlation of the data.
cS critical value (alias to alarm limit) of the Shewhart control chart.
df degrees of freedom – parameter of the t distribution.
delta potential shift in the data (in-control mean is zero.
N1 number of quadrature nodes for solving the ARL integral equation, dimension
of the resulting linear equation system is N1.
N2 second number of quadrature nodes for combining the probability density func-
tion of the first observation following the margin distribution and the solution of
the ARL integral equation.
N3 third number of quadrature nodes for solving the left eigenfunction integral
equation to determine the margin density (see Andel/Hrach, 2000), dimension
of the resulting linear equation system is N3.
INFI substitute of Inf – the left eigenfunction integral equation is defined on the
whole real axis; now it is reduced to (-INFI,INFI).
mode Controls the type of variables substitution that might improve the numerical
performance. Currently, "identity", "sin", "sinh", and "tan" (default) are
provided.
Details
Following the idea of Schmid (1995), 1-alpha times the data turns out to be an EWMA smoothing
of the underlying AR(1) residuals. Hence, by combining the solution of the EWMA ARL integral
equation and the stationary distribution of the AR(1) data (here Student t distribution is assumed)
one gets easily the overall ARL.
Value
It returns a single value resembling the zero-state ARL of a modified Shewhart chart.
120 xtshewhart.ar1.arl
Author(s)
Sven Knoth
References
J. Andel, K. Hrach (2000). On calculation of stationary density of autoregressive processes. Kyber-
netika, Institute of Information Theory and Automation AS CR 36(3), 311-319.
H. Kramer, W. Schmid (2000). The influence of parameter estimation on the ARL of Shewhart type
charts for time series. Statistical Papers 41(2), 173-196.
W. Schmid (1995). On the run length of a Shewhart chart for correlated data. Statistical Papers
36(1), 111-130.
See Also
xtewma.arl for zero-state ARL computation of EWMA control charts in case of Student t dis-
tributed data.
Examples
## will follow
Index
∗Topic ts xewma.q, 84
dphat, 3 xewma.q.prerun, 86
lns2ewma.arl, 4 xewma.sf, 89
lns2ewma.crit, 7 xewma.sf.prerun, 91
mewma.arl, 9 xgrsr.ad, 93
mewma.crit, 13 xgrsr.arl, 95
mewma.psi, 14 xgrsr.crit, 98
p.ewma.arl, 15 xsewma.arl, 99
phat.ewma.arl, 17 xsewma.crit, 101
quadrature.nodes.weights, 20 xsewma.q, 103
scusum.arl, 21 xsewma.sf, 105
scusum.crit, 23 xshewhart.ar1.arl, 107
scusums.arl, 24 xshewhartrunsrules.arl, 108
sewma.arl, 26 xtcusum.arl, 111
sewma.arl.prerun, 28 xtewma.ad, 112
sewma.crit, 30 xtewma.arl, 114
sewma.crit.prerun, 33 xtewma.q, 115
sewma.q, 35 xtewma.sf, 117
xtshewhart.ar1.arl, 119
sewma.q.prerun, 37
sewma.sf, 39 dphat, 3
sewma.sf.prerun, 40
tol.lim.fac, 41 lns2ewma.arl, 4
x.res.ewma.arl, 43 lns2ewma.crit, 7
xcusum.ad, 47
xcusum.arl, 49 mewma.ad (mewma.arl), 9
xcusum.crit, 52 mewma.arl, 9
xcusum.crit.L0h, 54 mewma.crit, 13
xcusum.crit.L0L1, 55 mewma.psi, 14
xcusum.q, 57
p.ewma.arl, 15
xcusum.sf, 58
phat.ewma.arl, 17
xDcusum.arl, 59
phat.ewma.crit (phat.ewma.arl), 17
xDewma.arl, 62
phat.ewma.lambda (phat.ewma.arl), 17
xDgrsr.arl, 67
pphat (dphat), 3
xDshewhartrunsrules.arl, 69
xewma.ad, 71 qphat (dphat), 3
xewma.arl, 73 quadrature.nodes.weights, 20
xewma.arl.f, 79
xewma.arl.prerun, 80 s.res.ewma.arl (x.res.ewma.arl), 43
xewma.crit, 83 scusum.arl, 21
121
122 INDEX
scusum.crit, 23 xshewhartrunsrules.ad
scusums.arl, 24 (xshewhartrunsrules.arl), 108
sewma.arl, 26 xshewhartrunsrules.arl, 108
sewma.arl.prerun, 28 xshewhartrunsrules.crit
sewma.crit, 30 (xshewhartrunsrules.arl), 108
sewma.crit.prerun, 33 xshewhartrunsrules.matrix
sewma.q, 35 (xshewhartrunsrules.arl), 108
sewma.q.crit.prerun (sewma.q.prerun), 37 xtcusum.arl, 111
sewma.q.prerun, 37 xtewma.ad, 112
sewma.sf, 39 xtewma.arl, 114
sewma.sf.prerun, 40 xtewma.q, 115
xtewma.sf, 117
tol.lim.fac, 41 xtshewhart.ar1.arl, 119
x.res.ewma.arl, 43
xcusum.ad, 47
xcusum.arl, 49
xcusum.crit, 52
xcusum.crit.L0h, 54
xcusum.crit.L0L1, 55
xcusum.q, 57
xcusum.sf, 58
xDcusum.arl, 59
xDewma.arl, 62
xDgrsr.arl, 67
xDshewhartrunsrules.arl, 69
xDshewhartrunsrulesFixedm.arl
(xDshewhartrunsrules.arl), 69
xewma.ad, 71
xewma.arl, 73
xewma.arl.f, 79
xewma.arl.prerun, 80
xewma.crit, 83
xewma.crit.prerun (xewma.arl.prerun), 80
xewma.q, 84
xewma.q.crit.prerun (xewma.q.prerun), 86
xewma.q.prerun, 86
xewma.sf, 89
xewma.sf.prerun, 91
xgrsr.ad, 93
xgrsr.arl, 95
xgrsr.crit, 98
xs.res.ewma.arl (x.res.ewma.arl), 43
xs.res.ewma.pms (x.res.ewma.arl), 43
xsewma.arl, 99
xsewma.crit, 101
xsewma.q, 103
xsewma.sf, 105
xshewhart.ar1.arl, 107