ecoEwma(h, w, k, n, delta = 2, lambda = 0.05, P0 = NULL, P1 = NULL, C0 = NULL, C1 = NULL, Cr = 25, Cf = 10, T0 = 0.0167, Tc = 1, Tf = 0, Tr = 0, a = 1, b = 0.1, d1 = 1, d2 = 1, nlevels = 30, sided = "two", par = NULL, contour.plot = FALSE, call.print = TRUE, ...)
echEwma(h, w, k, n, delta = 2, lambda = 0.05, P0 = NULL, P1 = NULL, C0 = NULL, C1 = NULL, Cr = 25, Cf = 10, T0 = 0.0167, Tc = 1, Tf = 0, Tr = 0, a = 1, b = 0.1, d1 = 1, d2 = 1, sided = "two")
contour.plot
is
TRUE.xewma.arl
ecoEwma
function returns an object of class
"edcc", which is a list of elements optimum
,
cost.frame
, FAR
and ATS
.
optimum
is a vector with the optimum parameters
and the corresponding ECH value; cost.frame
is a
dataframe with the optimum parameters and the
corresponding ECH values for all given n
(if
n
is not specified, cost.frame
won't be
returned); FAR
indicates the false alarm rate
during the in-control time, which is calculated as
lambda*(average number of false alarm); ATS
indicates the average time to signal after the occurrence
of an assignable cause, calculated as h*ARL2 - tau, where
tau is the expected time of occurrence of the assignable
cause given it occurs between the i-th and (i+1)st
samples. The echEwma
function returns the
calculated ECH value only.
w
should always be given, because the
range of w
is so restricted that optimization
algorithms usually don't converge. When parameter par
is specified, optimization
algorithms would be used as default. par
can be
specified as: par = c(h, k)
where h
and
k
are the initial values of smapling interval and
control limit when n
is specified; or par =
c(h, k, n)
. Good inital values may lead to good optimum
results.
When parameters h
, k
, n
are all
undefined, ecoEwma
function will try to find the
global optimum point to minimize the ECH (Expected Cost
per Hour) using optimization algorithms (optim
function), but in this case n
would not be
integer. It is usually helpful for the experimenter to
find the region where the optimum point may exist
quickly. When h
and k
are undefined but
n
is given as an integer vector, ecoEwma
function will try to find the optimum point for each
n
value using optimization algorithms. When
h
, k
and n
are all given,
ecoEwma
function will use a "grid method" way to
calculate the optimum point, that is ECH for all the
combinations of the parameters will be calculated. The
"grid method" way is much slower than using optimization
algorithms, but it would be a good choice when
optimization algorithms fail to work well.
For cost parameters either P0, P1 or C0, C1 is
needed. If P0 and P1 are given, they will be used first,
else C0 and C1 will be used. For economic design of the
EWMA chart, when d1
and d2
are both 1, only
if the difference between P0 and P1 keeps the same, the
results are identical. If the difference between C0 and
C1 keeps the same, the optimum parameters are almost the
same but the ECH(Expected Cost per Hour) values will
change.
echEwma
is used to calculate the ECH (Expected
Cost per Hour) for one given design point.
Lorenzen and Vance (1986). The economic design of control charts: a unified approach, Technometrics, 28. 3-10.
ecoXbar
, ecoCusum
,
xewma.arl
, update.edcc
,
optim
,contour
#Douglas (2009). Statistical quality control: a modern introduction, sixth edition, p470.
## Set w from 0.1 to 1 by 0.1 to catch the trend.
ecoEwma(w=seq(0.1,1,by=0.1),P0=110,P1=10,Cf=50)
#yy = ecoEwma(h = seq(.7,1,by=.01), w = seq(0.8,1,by=.01),k = seq(2.9,3.3, by = 0.01), n = 4:5, P0 = 110, P1 = 10, Cf = 50, contour.plot = TRUE)
##$optimum
##Optimum h Optimum k Optimum n Optimum w ECH
## 0.81000 2.99000 5.00000 0.95000 10.36482
#contour(yy)
Run the code above in your browser using DataLab