Description Usage Arguments Details Value References See Also Examples
Calculate the optimum parameters, n(sample size), h(sampling interval) and L(number of s.d. from control limits to center line) for Economic Design of the Xbar control chart .
1 2 3 4 5 6 7 8 9 10 11  ecoXbar(h, L, n, delta = 2, lambda = 0.05, P0 = NULL,
P1 = NULL, C0 = NULL, C1 = NULL, Cr = 25, Cf = 50,
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,
...)
echXbar(h, L, n, delta = 2, lambda = 0.05, P0 = NULL,
P1 = NULL, C0 = NULL, C1 = NULL, Cr = 25, Cf = 50,
T0 = 0.0167, Tc = 1, Tf = 0, Tr = 0, a = 1, b = 0.1,
d1 = 1, d2 = 1, sided = "two")

h 
sampling interval. It can be a numeric vector or left undefined. See 'Details' 
L 
number of standard deviations from control limits to center line. It can be a numeric vector or left undefined. See 'Details' 
n 
sample size. It can be an integer vector or left undefined. See 'Details' 
lambda 
we assume the incontrol time follows an exponential distribution with mean 1/lambda. Default value is 0.05. 
delta 
shift in process mean in standard deviation units when assignable cause occurs (delta = (mu1  mu0)/sigma), where sigma is the standard deviation of observations; mu0 is the incontrol process mean; mu1 is the outofcontrol process mean. Default value is 2. 
P0 
profit per hour earned by the process operating in control. See 'Details'. 
P1 
profit per hour earned by the process operating out of control(P0 > P1). 
C0 
cost per hour due to nonconformities produced while the process is in control. 
C1 
cost per hour due to nonconformities produced while the process is out of control.(C1 > C0) 
Cr 
cost for searching and repairing the assignable cause, including any downtime. 
Cf 
cost per false alarm, including the cost of searching for the cause and the cost of downtime if production ceases during search. 
T0 
time to sample and chart one item. 
Tc 
expected time to discover the assignable cause. 
Tf 
expected search time when false alarm occurs. 
Tr 
expected time to repair the process. 
a 
fixed cost per sample. 
b 
cost per unit sampled. 
d1 
flag for whether production continues during searches (1yes, 0no). Default value is 1. 
d2 
flag for whether production continues during repairs (1yes, 0no). Default value is 1. 
nlevels 
number of contour levels desired. Default
value is 30. It works only when 
sided 
distinguish between one and twosided Xbar
chart by choosing “one” or “two” respectively. When

par 
initial values for the parameters to be optimized over. It can be a vector of length 2 or 3. See 'Details' 
contour.plot 
a logical value indicating whether a contour plot should be drawn. Default is FALSE. Only works when the parameters h, L and n are all specified. 
call.print 
a logical value indicating whether the "call" should be printed on the contour plot. Default is TRUE 
... 
other arguments to be passed to 
When parameter par
is specified, optimization
algorithms would be used as default. par
can be
specified as: par = c(h, L)
where h
and
L
are the initial values of smapling interval and
control limit when n
is specified; or par =
c(h, L, n)
. Good inital values may lead to good optimum
results.
When parameters h
, L
, n
are all
undefined, ecoXbar
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 L
are undefined but n
is given as an integer vector, ecoXbar
function
will try to find the optimum point for each n
value using optimization algorithms. When h
,
L
and n
are all given, ecoXbar
function will use the "grid method" 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
Xbar 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.
echXbar
is used to calculate the ECH (Expected
Cost per Hour) for one given design point.
The ecoXbar
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 incontrol 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 ith and (i+1)st
samples. The echXbar
function returns the
calculated ECH value only.
Weicheng Zhu, Changsoon Park (2013), edcc: An R Package for the Economic Design of the Control Chart. Journal of Statistical Software, 52(9), 124. http://www.jstatsoft.org/v52/i09/
Douglas (2009). Statistical quality control: a modern introduction, sixth edition, 463471.
Lorenzen and Vance (1986). The economic design of control charts: a unified approach, Technometrics, 28. 310.
ecoCusum
, ecoEwma
,
contour
, optim
,
update.edcc
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22  # Douglas (2009). Statistical quality control: a modern introduction, sixth edition, p470.
# In control profit per hour is 110, out of control profit per hour is 10
ecoXbar(P0=110,P1=10)
# In control profit per hour is 150, out of control profit per hour
# is 50, the result is identical with the previous one, because the
#difference between P0 and P1 are the same
ecoXbar(P0=150,P1=50)
# In control cost per hour is 0, out of control cost per hour is 100.
# The result is the same with the previous one
ecoXbar(C0=0,C1=100)
# The optimum parameters are the same with the previous one,
# but Cost values are different. See 'details'
ecoXbar(C0=10,C1=110)
# Based on the global optimum above, we specify the range of the
# parameters like this
x < ecoXbar(h=seq(0.7,0.9,by=.01),L=seq(2.8,3.3,by=.01),n=4:6,P0=110,
P1=10,nlevels=50,contour.plot=TRUE)
x
# Modify the contour plot
contour(x,nlevels=20,lty=2,col=2,call.print=FALSE)
# update the parameters
update(x,P0=NULL,P1=NULL,C0=10,C1=110)

Loading required package: spc
$optimum
Optimum h Optimum L Optimum n ECH
0.8146052 2.9813756 5.0000000 10.3670006
$FAR
[1] 0.003451395
$ATS
[1] 0.4695136
$optimum
Optimum h Optimum L Optimum n ECH
0.8146052 2.9813756 5.0000000 10.3670006
$FAR
[1] 0.003451395
$ATS
[1] 0.4695136
$optimum
Optimum h Optimum L Optimum n ECH
0.8146052 2.9813756 5.0000000 10.3670006
$FAR
[1] 0.003451395
$ATS
[1] 0.4695136
$optimum
Optimum h Optimum L Optimum n ECH
0.8145281 2.9806844 5.0000000 20.3670015
$FAR
[1] 0.003459527
$ATS
[1] 0.4693838
$optimum
Optimum h Optimum L Optimum n ECH
0.81000 2.98000 5.00000 10.36708
$cost.frame
Optimum h Optimum L Optimum n ECH
0.77 2.83 4 10.48951
0.81 2.98 5 10.36708
0.85 3.13 6 10.38023
$FAR
[1] 0.003487046
$ATS
[1] 0.4666755
$optimum
Optimum h Optimum L Optimum n ECH
0.81000 2.98000 5.00000 20.36708
$cost.frame
Optimum h Optimum L Optimum n ECH
0.77 2.83 4 20.48951
0.81 2.98 5 20.36708
0.85 3.13 6 20.38023
$FAR
[1] 0.003487046
$ATS
[1] 0.4666755
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.