ecoEwma: Economic design for the EWMA control chart

Description Usage Arguments Details Value References See Also Examples

View source: R/ecoDesign.R

Description

Calculate the optimum parameters, n(sample size), h(sampling interval), w(weight to the present sample) and k(number of s.d. from control limits to center line) for economic Design of the EWMA control chart .

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
  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")

Arguments

h

sampling interval. It can be a numeric vector or left undefined. See 'Details'

w

the weight value between 0 and 1 given to the latest sample. It must be specified.

k

control limit coefficient. 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'

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 in-control process mean; mu1 is the out-of-control process mean. Default value is 2.

lambda

we assume the in-control time follows a exponential distribution with mean 1/lambda. Default value is 0.05.

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

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 (1-yes, 0-no). Default value is 1.

d2

flag for whether production continues during repairs (1-yes, 0-no). Default value is 1.

nlevels

number of contour levels desired. Default value is 30. It works only when contour.plot is TRUE.

sided

distinguish between one- and two-sided EWMA control chart by choosing "one" and "two", respectively. See details in xewma.arl

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.

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 contour function.

Details

Parameter 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.

Value

The 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.

References

Weicheng Zhu, Changsoon Park (2013), edcc: An R Package for the Economic Design of the Control Chart. Journal of Statistical Software, 52(9), 1-24. http://www.jstatsoft.org/v52/i09/

Lorenzen and Vance (1986). The economic design of control charts: a unified approach, Technometrics, 28. 3-10.

See Also

ecoXbar, ecoCusum, xewma.arl, update.edcc, optim,contour

Examples

1
2
3
4
5
6
7
8
9
#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)

Example output

Loading required package: spc
$optimum
 Optimum h  Optimum k  Optimum n  Optimum w        ECH 
 0.8282283  3.0311392  5.3426142  1.0000000 10.3603658 

$cost.frame
 Optimum h Optimum k Optimum n Optimum w      ECH
 1.0425911  2.017433  9.573487       0.1 11.62842
 0.9416400  2.509054  8.106431       0.2 11.11996
 0.8936145  2.728392  7.085852       0.3 10.83632
 0.8657535  2.850289  6.418526       0.4 10.66056
 0.8483392  2.925022  5.970261       0.5 10.54421
 0.8372298  2.972906  5.667958       0.6 10.46501
 0.8303430  3.003967  5.470132       0.7 10.41171
 0.8267789  3.022460  5.357692       0.8 10.37827
 0.8260608  3.031458  5.315691       0.9 10.36159
 0.8282283  3.031139  5.342614       1.0 10.36037

$FAR
[1] 0.002881128

$ATS
[1] 0.465852

edcc documentation built on May 2, 2019, 1:40 p.m.

Related to ecoEwma in edcc...