9.3 Estimating σ • It is not recommended to estimate the process variability σ 2 by the sample variance Pi 2 j=1 (xj − x) 2 s = i−1 • s2 gives an estimate of the process variability that is too large because it takes into account the inherent process variability, measurement error, as well as long-term variability due to assignable causes (such as shifts in the mean). • The detection of variability due to assignable causes is the goal of quality control procedures. Thus, incorporating these additional sources of variability when estimating the process variability defeats the purpose of the cusum procedure. • Therefore, an estimate of variability that contains inherent process variability and measurement error (but excludes assignable cause variability) is desired. • The mean squared successive difference (MSSD) is a good estimator of this variability: M SSD = where there are i samples to be included in the cusum. • The estimate of the process standard deviation is σ b= √ M SSD. • If preliminary data exist and little change in process variability is expected, then calculate σ b from the preliminary data and use it to monitor the process. • If preliminary data is not available, then σ b can be updated as successive samples are taken. 175 Piston Ring Diameter Cusum Example (σ unknown): • We will now make cusum plots and generate the tabular cusum for the 25 sample means assuming σ is unknown. • We assume the in-control mean µ0 = 74 and the estimated σ b = M SSD = .00982998. • The following table contains the tabular cusum values with resets after each signal. CUSUM with Reset after Signal (sigma unknown) sample xbar n cusum_l hsigma cusum_h flag 1 74.0102 5 0 0.017584 0.008002 2 74.0006 5 0 0.017584 0.006404 3 74.0080 5 0 0.017584 0.012206 4 74.0030 5 0 0.017584 0.013008 5 74.0034 5 0 0.017584 0.014210 6 73.9956 5 .002201945 0.017584 0.007612 7 74.0000 5 .000003890 0.017584 0.005414 8 73.9968 5 .001005836 0.017584 0.000016 9 74.0042 5 0 0.017584 0.002018 10 73.9980 5 0 0.017584 0.000000 11 73.9942 5 .003601945 0.017584 0.000000 12 74.0014 5 .000003890 0.017584 0.000000 13 73.9984 5 0 0.017584 0.000000 14 73.9902 5 .007601945 0.017584 0.000000 15 74.0060 5 0 0.017584 0.003802 16 73.9966 5 .001201945 0.017584 0.000000 17 74.0008 5 0 0.017584 0.000000 18 74.0074 5 0 0.017584 0.005202 19 73.9982 5 0 0.017584 0.001204 20 74.0092 5 0 0.017584 0.008206 21 73.9998 5 0 0.017584 0.005808 22 74.0016 5 0 0.017584 0.005210 23 74.0024 5 0 0.017584 0.005412 24 74.0052 5 0 0.017584 0.008414 25 73.9982 5 0 0.017584 0.004416 176 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 1 2 3 4 5 6 7 8 9 10 11 12 13 14 177 15 16 17 18 19 20 21 22 23 24 25 73.998200 74.005200 74.002400 74.001600 73.999800 74.009200 73.998200 74.007400 74.000800 73.996600 74.006000 73.990200 73.998400 74.001400 73.994200 73.998000 74.004200 73.996800 74.000000 73.995600 74.003400 74.003000 74.008000 74.000600 74.010200 Subgroup Sample Subgroup sample Size Mean 0.01617714 0.00870057 0.01192896 0.00743640 0.00816701 0.00798123 0.00846759 0.00698570 0.01056882 0.00779744 0.00731437 0.01530359 0.01045466 0.00421900 0.00286356 0.00628490 0.00554076 0.01225561 0.00552268 0.00870632 0.01221884 0.00908295 0.01474788 0.00750333 0.01477159 Subgroup Std Dev 0.0118 0.02940000 0.0096 0.03120000 0.0074 0.02600000 0.0052 0.02360000 0.0030 0.02200000 0.0008 0.02220000 -0.0014 0.01300000 -0.0036 0.01480000 -0.0058 0.00740000 -0.0080 0.00660000 -0.0102 0.01000000 -0.0124 0.00400000 -0.0146 0.01380000 -0.0168 0.01540000 -0.0190 0.01400000 -0.0212 0.01980000 -0.0234 0.02180000 -0.0256 0.01760000 -0.0277 0.02080000 -0.0299 0.02080000 -0.0321 0.02520000 -0.0343 0.02180000 -0.0365 0.01880000 -0.0387 0.01080000 0.0470 0.0492 0.0514 0.0536 0.0558 0.0580 0.0602 0.0624 0.0646 0.0668 0.0690 0.0712 0.0734 0.0756 0.0778 0.0800 0.0822 0.0844 0.0865 0.0887 0.0909 0.0931 0.0953 0.0975 0.0997 V-Mask V-Mask Upper Limit Cusum Limit Exceeded -0.0409 0.01020000 V-Mask Lower Limit Cumulative Sum Chart Summary for diameter The CUSUM Procedure CUSUM for Piston-Ring Diameters (sigma unknown) • We will now make a cusum plot for the 25 sample means (n = 5) assuming a process in-control mean µ0 = 74 with an estimated process standard deviation σ b = M SSD = .00982998. CUSUM for Piston-Ring Diameters (sigma unknown) The CUSUM Procedure 5 5 5 5 5 5 5 5 5 5 5 5 14 15 16 17 18 19 20 21 22 23 24 25 5 9 5 5 8 13 5 7 5 5 6 12 5 5 5 5 4 11 5 3 5 5 2 10 5 1 178 73.998200 74.005200 74.002400 74.001600 73.999800 74.009200 73.998200 74.007400 74.000800 73.996600 74.006000 73.990200 73.998400 74.001400 73.994200 73.998000 74.004200 73.996800 74.000000 73.995600 74.003400 74.003000 74.008000 74.000600 74.010200 0.01617714 0.00870057 0.01192896 0.00743640 0.00816701 0.00798123 0.00846759 0.00698570 0.01056882 0.00779744 0.00731437 0.01530359 0.01045466 0.00421900 0.00286356 0.00628490 0.00554076 0.01225561 0.00552268 0.00870632 0.01221884 0.00908295 0.01474788 0.00750333 0.01477159 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00120195 0.00000000 0.00760195 0.00000000 0.00000390 0.00360195 0.00000000 0.00000000 0.00100585 0.00000390 0.00220195 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 Decision Decision Interval Cusum Interval Exceeded 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 73.998200 74.005200 74.002400 74.001600 73.999800 74.009200 73.998200 74.007400 74.000800 73.996600 74.006000 73.990200 73.998400 74.001400 73.994200 73.998000 74.004200 73.996800 74.000000 73.995600 74.003400 74.003000 74.008000 74.000600 74.010200 Subgroup Sample Subgroup sample Size Mean 0.01617714 0.00870057 0.01192896 0.00743640 0.00816701 0.00798123 0.00846759 0.00698570 0.01056882 0.00779744 0.00731437 0.01530359 0.01045466 0.00421900 0.00286356 0.00628490 0.00554076 0.01225561 0.00552268 0.00870632 0.01221884 0.00908295 0.01474788 0.00750333 0.01477159 Subgroup Std Dev 0.00441560 0.00841365 0.00541170 0.00520975 0.00580780 0.00820585 0.00120390 0.00520195 0.00000000 0.00000000 0.00380195 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00201755 0.00001560 0.00541365 0.00761170 0.01420975 0.01300780 0.01220585 0.00640390 0.00800195 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 0.0176 Decision Decision Interval Cusum Interval Exceeded Cumulative Sum Chart Summary for diameter Cumulative Sum Chart Summary for diameter Subgroup Std Dev The CUSUM Procedure The CUSUM Procedure Subgroup Sample Subgroup sample Size Mean UPPER ONE-SIDED CUSUM (sigma unknown) LOWER ONE-SIDED CUSUM (sigma unknown) • We will now generate the upper and lower tabular cusums for the 25 sample means followed by one-sided cusum plots. UPPER ONE-SIDED CUSUM (sigma unknown) The CUSUM Procedure LOWER ONE-SIDED CUSUM (sigma unknown) The CUSUM Procedure 179 SAS Cusum Code for Piston-Ring Diameter Data DM ’LOG; CLEAR; OUT; CLEAR;’; ODS GRAPHICS ON; * ODS PRINTER PDF file=’C:\COURSES\ST528\SAS\CUSUM2.PDF’; OPTIONS NODATE NONUMBER; DATA piston; DO sample=1 TO 25; DO item=1 TO 5; INPUT diameter @@; diameter = diameter+70; OUTPUT; END; END; LINES; 4.030 4.002 4.019 3.992 4.008 3.995 3.992 4.001 4.011 4.004 3.988 4.024 4.021 4.005 4.002 4.002 3.996 3.993 4.015 4.009 3.992 4.007 4.015 3.989 4.014 4.009 3.994 3.997 3.985 3.993 3.995 4.006 3.994 4.000 4.005 3.985 4.003 3.993 4.015 3.988 4.008 3.995 4.009 4.005 4.004 3.998 4.000 3.990 4.007 3.995 3.994 3.998 3.994 3.995 3.990 4.004 4.000 4.007 4.000 3.996 3.983 4.002 3.998 3.997 4.012 4.006 3.967 3.994 4.000 3.984 4.012 4.014 3.998 3.999 4.007 4.000 3.984 4.005 3.998 3.996 3.994 4.012 3.986 4.005 4.007 4.006 4.010 4.018 4.003 4.000 3.984 4.002 4.003 4.005 3.997 4.000 4.010 4.013 4.020 4.003 3.988 4.001 4.009 4.005 3.996 4.004 3.999 3.990 4.006 4.009 4.010 3.989 3.990 4.009 4.014 4.015 4.008 3.993 4.000 4.010 3.982 3.984 3.995 4.017 4.013 ; SYMBOL1 v=dot width=3; PROC CUSUM DATA=piston; XCHART diameter*sample=’1’ / MU0=74 SMETHOD=noweight H=4.0 K=0.5 DELTA=1.0 DATAUNITS HAXIS = 1 TO 25 TABLESUMMARY TABLEOUT OUTTABLE = qsum ; INSET ARL0 ARLDELTA H K SHIFT / POS = n; LABEL diameter=’Diameter Cusum’ sample = ’Piston Ring Sample’; TITLE ’CUSUM for Piston-Ring Diameters (sigma unknown)’; PROC CUSUM DATA=piston; XCHART diameter*sample=’1’ / MU0=74 SMETHOD=noweight H=4.0 K=0.5 DELTA=1.0 DATAUNITS HAXIS=1 TO 25 SCHEME=onesided TABLESUMMARY TABLEOUT; INSET ARL0 ARLDELTA H K SHIFT / POS = n; LABEL diameter=’Diameter Cusum’ sample = ’Piston Ring Sample’; TITLE ’UPPER ONE-SIDED CUSUM (sigma unknown)’; 180 PROC CUSUM DATA=piston; XCHART diameter*sample=’1’ / MU0=74 SMETHOD=noweight H=4.0 K=0.5 DELTA=-1.0 DATAUNITS HAXIS=1 TO 25 SCHEME=onesided TABLESUMMARY TABLEOUT; INSET ARL0 H K SHIFT / POS = ne; LABEL diameter=’Diameter Cusum’ sample = ’Piston Ring Sample’; TITLE ’LOWER ONE-SIDED CUSUM (sigma unknown)’; *** The following code will make a table with resetting ***; *** after an out-of-control signal is detected ***; DATA qsum; SET qsum; h=4; k=.5; sigma=.00983; aim=74; ** enter values **; xbar=_subx_; n=_subn_; hsigma=h*sigma/SQRT(_subn_); ksigma=k*sigma/SQRT(_subn_); RETAIN cusum_l 0 cusum_h 0; IF (-hsigma < cusum_l < hsigma) THEN DO; cusum_l = cusum_l + (aim - ksigma) - xbar; IF cusum_l < 0 then cusum_l=0; END; IF (-hsigma < cusum_h < hsigma) THEN DO; cusum_h = cusum_h + xbar - (aim + ksigma); IF cusum_h < 0 then cusum_h=0; END; IF MAX(cusum_l,cusum_h) ge hsigma THEN DO; IF (cusum_l ge hsigma) THEN DO; flag=’lower’; OUTPUT; END; IF (cusum_h ge hsigma) THEN DO; flag=’upper’; OUTPUT; END; cusum_l=0; cusum_h=0; END; ELSE OUTPUT; PROC PRINT DATA=qsum; ID sample; VAR xbar n cusum_l hsigma cusum_h flag; TITLE ’CUSUM with Reset after Signal (sigma unknown)’; RUN; 181 9.4 Designing the Cusum Control Chart for x or x • σ = the process standard deviation. – In the formulas, we will assume the rational (sample) subgroup size is n = 1. √ – When n > 1, replace σ with σ/ n in all formulas. • , the specified magnitude of the smallest shift in the process mean to be detected. • K is called the reference or slack value. – Generally, we want to choose k relative to the size of the shift we want to detect. This will determine K. It is suggested that K = ∆2 (or equivalently, k = 2δ ) because this choice of K has been shown to work well in practice. – The choice of k = 2δ yields a cusum control chart that comes close to minimizing the ARL for detecting a shift of size ∆ = δσ. • H is called the decision interval. – Montgomery suggests using h = 4 or, equivalently, H = 4σ. DuPont suggests using h = 5 or, equivalently, H = 5σ. • Because the ARL table uses h and k (the standardized values of H and K) and a specified σ, or an estimate σ b is required in order to convert from standardized units k and h to the units of the original data K = kσ and H = hσ (or, K = kb σ and H = hb σ. • There are two common methods for assigning cusum parameter values: METHOD 1: Given k, δ, and the in-control ARL. – Using k and a specified in-control ARL, a reasonable value of h can be found from the ARL table or use the cusumarl function in SAS. Then, K = kσ and H = hσ. – Given this value of h, the researcher should verify that the out-of-control ARL corresponding to a shift of ∆ = δσ is sufficiently small. – Adjustments to h and k can be made to find an acceptable balance between the in-control and out-of-control ARL’s. – If σ has to be estimated, replace σ with σ b in the formulas. METHOD 2: Given the in-control ARL0 and the out-of-control ARL1 for specified δ. – A second way to choose h and k is to enter the ARL table with desired values for the in-control ARL0 and for the out-of-control ARL1 for a specified value of δ, say δ0 . – The columns contain ARL values for various values of δ. The column labeled δ = 0 represents the in-control ARL0 . – By following the δ = 0 column and the δ = δ0 column down until an acceptable pair of in-control and out-of-control ARL’s is found, the values of h and k can be found by tracing that row over to the first two columns labeled h and k (or use the cusumarl function in SAS). 182 9.4.1 Estimation of the ARL • Several techniques have been developed to calculate/estimate the ARL for a cusum. – A commonly-adopted approach based on Markov chains was developed by Brooks and Evans (Biometrika (1972) 59, 3, 539-549.) – Hawkins (J. of Quality Technology (1992), 24, 1, 37-43) provides an estimating equation that yields accurate ARL values estimates. – SAS uses the integral equation method described by Goel and Wu Technometrics (1971), 13, 221-230) and Lucas and Crosier (Technometrics (1982), 24, 199-205). Find h such that ARL0 ≈ 300 given k = .5. Find h such that ARL0 ≈ 200 given k = .25. Example 1 for Method 1: Example 2 for Method 1: EXAMPLE 1 METHOD 1 k h 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 5.0 k h 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 4.50 4.51 4.52 4.53 4.54 4.55 4.56 4.57 4.58 4.59 4.60 arl2 167.684 185.868 205.976 228.210 252.793 279.973<-310.023<-343.243 379.968 420.566 465.444 arl2 279.973 282.844 285.744 288.674 291.633 294.621 297.640 300.689<-303.769 306.880 310.023 EXAMPLE 2 METHOD 1 arl1 k 335.367 371.736 411.952 456.420 505.587 559.947 620.046 686.487 759.937 841.133 930.889 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 arl1 559.947 565.689 571.489 577.348 583.265 589.243 595.280 601.379 607.539 613.761 620.046 h 6.0 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 6.9 7.0 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 8.0 k h 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 6.80 6.81 6.82 6.83 6.84 6.85 6.86 6.87 6.88 6.89 6.90 183 arl2 125.402 132.572 140.120 148.064 156.427 165.228 174.491 184.240 194.498<-205.292<-216.650 228.601 241.175 254.404 268.321 282.962 298.363 314.565 331.608 349.534 368.390 arl1 250.804 265.144 280.239 296.129 312.854 330.457 348.983 368.479 388.996 410.585 433.301 457.202 482.350 508.807 536.641 565.923 596.727 629.130 663.215 699.068 736.780 arl2 194.498 195.553 196.613 197.679 198.750 199.826<-200.908 201.996 203.089 204.188 205.292 arl1 388.996 391.106 393.226 395.357 397.500 399.653 401.817 403.992 406.179 408.376 410.585 SAS Code for Examples 1 and 2 for Method 1: DM ’LOG; CLEAR; OUT; CLEAR;’; ODS LISTING; OPTIONS LS=72 PS=54 NODATE NONUMBER; *** DESIGNING A CUSUM: METHOD 1, EXAMPLE 1; DATA csmarl; k = .5; * DO h = 4 TO 5 BY .1; DO h = 4.5 TO 4.6 BY .01; arl2 = CUSUMARL(’twosided’,0,h,k); arl1 = CUSUMARL(’onesided’,0,h,k); OUTPUT; END; PROC PRINT DATA=csmarl; ID k h; RUN; *** DESIGNING A CUSUM: METHOD 1, EXAMPLE 2; DATA csmarl; k = .25; * DO h = 6 TO 8 BY .1; DO h = 6.8 TO 6.9 BY .01; arl2 = CUSUMARL(’twosided’,0,h,k); arl1 = CUSUMARL(’onesided’,0,h,k); OUTPUT; END; PROC PRINT DATA=csmarl; ID k h; RUN; Example for Method 2: Find h and k such that ARL0 ≈ 150 and ARL1 ≈ 9 for a 1σ shift (δ = 1). METHOD 2 EXAMPLE Obs k h 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 0.25 0.25 0.25 0.25 0.25 0.30 0.30 0.30 0.30 0.70 0.70 0.75 0.75 0.80 0.80 0.85 0.85 6.30 6.31 6.32 6.33 6.34 5.62 5.63 5.64 5.65 2.92 2.93 2.74 2.75 2.58 2.59 2.43 2.44 arl0 arl1 148.064 148.882 149.703 150.528 151.358 148.498 149.459 150.427 151.401 149.190 151.337<-148.937 151.233 149.179 151.636 148.069 150.663 9.12655 9.13988 9.15321 9.16655 9.17988 8.73056 8.74485 8.75913 8.77342 8.56659 8.59707<-8.77763 8.81201 9.03707 9.07601 9.31376 9.35796 arl2 4.24303 4.24874 4.25445 4.26016 4.26587 3.95485 3.96074 3.96663 3.97252 2.95506 2.96279 GOOD 2.90746 2.91555 2.87143 2.87990 2.83984 2.84870 *** DESIGNING A CUSUM: METHOD 2 EXAMPLE; DATA csmarl; DO k = .25 TO 1 BY .05; DO h = 2 TO 8 BY .01; arl0 = CUSUMARL(’twosided’,0,h,k); arl1 = CUSUMARL(’twosided’,1,h,k); arl2 = CUSUMARL(’twosided’,2,h,k); *** 2 sigma shift for comparison; IF (148 le arl0 le 152) and (8.5 le arl1 le 9.5) THEN OUTPUT; END; END; PROC PRINT DATA=csmarl; RUN; 184 185 9.5 Fast Initial Response (FIR) for Cusum Charts • The situation may arise where the researcher is concerned that the process may be in the out-of-control state at start-up or when the process is restarted after an adjustment has been made to the process. • The standard cusum procedure may be slow in detecting a shift in the process that is present immediately upon start-up or restart. • Lucas and Crosier (1982) suggested a modification to the standard cusum procedure that would decrease the response time required to detect an out-of-control signal that is present immediately upon start-up or restart. • In the computational tabular form, a standard cusum has both the high and low cusum initially set to 0 (C0− = C0+ = 0). • The suggested modification is to initially set both the high and low cusum to some specified positive, nonzero constant c (C0− = C0+ = c) between 0 and decision interval H. This is called the headstart value for a fast initial response (FIR) cusum. • Lucas and Crosier suggested setting c = H . 2 • The design of the FIR cusum is similar to the design of the standard cusum. The two major differences between the two designs are: 1. Rather than using the ARL table for a standard cusum design, one must use a table of ARL’s for the FIR cusum design. 2. Rather than using C0− = C0+ = 0 in the formulae of the computational form, one should use C0− = C0+ = H/2. Or, instead of using tables, you can also just utilize the ‘headstart’ FIR option in the cusumarl function in SAS. • If the process is in the in-control state initially, the cusums Ci+ and Ci− will go to zero in a small number of samples. • If the process is in the out-of-control state initially, then one of the cusums will exceed H after a small number of samples. • Once the FIR cusum scheme has been set up, one can proceed with quality control testing in the same manner as with the standard cusum scheme. • The benefit of the FIR cusum procedure is that the decrease in the out-of-control ARL1 is relatively large, while the decrease in the in-control ARL0 is relatively small. • This implies that an out-of-control signal can be detected in fewer runs with the FIR than without it. • To adjust for the slight decrease in the in-control ARL0 , H can be adjusted to give the desired in-control ARL0 . • To use a FIR cusum to generate the tabular cusum in PROC CUSUM in SAS, insert as one of the cusum options HEADSTART=nn where nn = H/2 (or any other headstart value). 186 179 187 GENERATING FIR CUSUM ARLs h k delta fir arl1 arl2 h k delta fir arl1 arl2 4 4 4 4 4 4 4 4 4 4 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.0 0.0 0.5 0.5 1.0 1.0 1.5 1.5 2.0 2.0 0 2 0 2 0 2 0 2 0 2 77.08 66.57 13.29 8.99 6.06 3.70 3.91 2.35 2.93 1.77 38.54 28.03 13.20 8.68 6.06 3.69 3.91 2.35 2.93 1.77 6 6 6 6 6 6 6 6 6 6 0.50 0.50 0.50 0.50 0.50 0.50 0.50 0.50 0.50 0.50 0.0 0.0 0.5 0.5 1.0 1.0 1.5 1.5 2.0 2.0 0 3 0 3 0 3 0 3 0 3 4 4 4 4 4 4 4 4 4 4 0.50 0.50 0.50 0.50 0.50 0.50 0.50 0.50 0.50 0.50 0.0 0.0 0.5 0.5 1.0 1.0 1.5 1.5 2.0 2.0 0 2 0 2 0 2 0 2 0 2 335.37 316.38 26.68 20.25 8.38 5.29 4.75 2.86 3.34 2.01 167.68 148.70 26.63 20.06 8.38 5.29 4.75 2.86 3.34 2.01 8 8 8 8 8 8 8 8 8 8 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.0 0.0 0.5 0.5 1.0 1.0 1.5 1.5 2.0 2.0 0 4 0 4 0 4 0 4 0 4 6 6 6 6 6 6 6 6 6 6 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.0 0.0 0.5 0.5 1.0 1.0 1.5 1.5 2.0 2.0 0 3 0 3 0 3 0 3 0 3 250.80 225.44 20.90 13.48 8.73 5.05 5.51 3.17 4.07 2.37 125.40 100.04 20.89 13.38 8.73 5.05 5.51 3.17 4.07 2.37 8 8 8 8 8 8 8 8 8 8 0.50 0.50 0.50 0.50 0.50 0.50 0.50 0.50 0.50 0.50 0.0 0.0 0.5 0.5 1.0 1.0 1.5 1.5 2.0 2.0 0 18967.17 9483.58 4 18783.72 9300.14 0 84.00 84.00 4 63.25 63.24 0 16.37 16.37 4 9.42 9.42 0 8.75 8.75 4 4.87 4.87 0 6.01 6.01 4 3.37 3.37 DM ’LOG; CLEAR; OUT; CLEAR;’; ODS LISTING; OPTIONS LS=72 PS=54 NODATE NONUMBER; *** DESIGNING A CUSUM WITH A FIR; DATA firarl; DO h = 4 TO 8 BY 2; DO k = .25 TO .5 BY .25; DO delta = 0 to 2 by .5; DO fir = 0 to h/2 by h/2; arl1 = CUSUMARL(’onesided’,delta,h,k,fir); arl2 = CUSUMARL(’twosided’,delta,h,k,fir); END; END; END; END; PROC PRINT DATA=firarl; ID h k delta fir; TITLE ’GENERATING FIR CUSUM ARLs’; RUN; 188 OUTPUT; 2553.11 1276.55 2490.87 1214.32 51.34 51.34 38.76 38.71 12.37 12.37 7.38 7.38 6.75 6.75 3.87 3.87 4.68 4.68 2.70 2.70 736.78 684.30 28.76 17.86 11.39 6.39 7.11 3.97 5.21 2.94 368.39 315.91 28.76 17.83 11.39 6.39 7.11 3.97 5.21 2.94 SAS code for FIR example using piston ring data DM ’LOG; CLEAR; OUT; CLEAR;’; * ODS PRINTER PDF file=’C:\COURSES\ST528\SAS\fir1.pdf’; ODS LISTING; OPTIONS LS=78 PS=500 NONUMBER NODATE; DATA piston; DO sample=1 TO 25; DO item=1 TO 5; n= item + 5*(sample-1); INPUT diameter @@; diameter = diameter+70; OUTPUT; END; END; LINES; 4.030 4.002 4.019 3.992 4.008 3.995 3.992 3.988 4.024 4.021 4.005 4.002 4.002 3.996 3.992 4.007 4.015 3.989 4.014 4.009 3.994 3.995 4.006 3.994 4.000 4.005 3.985 4.003 4.008 3.995 4.009 4.005 4.004 3.998 4.000 3.994 3.998 3.994 3.995 3.990 4.004 4.000 3.983 4.002 3.998 3.997 4.012 4.006 3.967 4.012 4.014 3.998 3.999 4.007 4.000 3.984 3.994 4.012 3.986 4.005 4.007 4.006 4.010 3.984 4.002 4.003 4.005 3.997 4.000 4.010 3.988 4.001 4.009 4.005 3.996 4.004 3.999 4.010 3.989 3.990 4.009 4.014 4.015 4.008 3.982 3.984 3.995 4.017 4.013 ; SYMBOL VALUE=dot WIDTH=3; 4.001 3.993 3.997 3.993 3.990 4.007 3.994 4.005 4.018 4.013 3.990 3.993 4.011 4.015 3.985 4.015 4.007 4.000 4.000 3.998 4.003 4.020 4.006 4.000 PROC CUSUM DATA=piston; XCHART diameter*sample=’1’ / mu0=74 sigma0=.005 h=4.0 k=0.5 delta=1.0 dataunits headstart = 2 outtable = qsum tablesummary tablecomp haxis=0 TO 25 vaxis=0 TO .035 by .005; INSET ARL0 ARLDELTA H K SHIFT / POS = se; LABEL diameter=’Diameter Cusum’ sample = ’Piston Ring Sample’; TITLE ’FIR CUSUM for Piston-Ring Diameters’; DATA qsum; set qsum; h=4; k=.5; sigma=.005; aim=74; ** enter values **; xbar=_subx_; n=_subn_; hsigma=h*sigma/sqrt(_subn_); ksigma=k*sigma/sqrt(_subn_); retain cusum_l 0 cusum_h 0; 189 4.004 4.009 3.993 3.988 3.995 3.996 3.984 3.996 4.000 4.003 4.009 4.010 fir = 2*sigma/sqrt(_subn_); if sample=1 then do; cusum_l = fir; cusum_h = fir; END; if (-hsigma < cusum_l < hsigma) then do; cusum_l = cusum_l + (aim - ksigma) - xbar; if cusum_l < 0 then cusum_l=0; END; if (-hsigma < cusum_h < hsigma) then do; cusum_h = cusum_h + xbar - (aim + ksigma); if cusum_h < 0 then cusum_h=0; END; if max(cusum_l,cusum_h) ge hsigma then if (cusum_l ge hsigma) then do; flag=’lower’; if (cusum_h ge hsigma) then do; flag=’upper’; cusum_l=fir; cusum_h=fir; else output; do; output; END; output; END; END; PROC PRINT DATA=qsum; ID sample; var xbar n fir cusum_l hsigma cusum_h flag; TITLE ’FIR CUSUM with Reset after Signal’; PROC CUSUM DATA=piston; XCHART diameter*sample=’1’ / mu0=74 sigma0=.005 h=4.0 k=0.5 delta=1.0 dataunits headstart=2 scheme=onesided tablesummary tablecomp haxis=1 TO 25; INSET ARL0 ARLDELTA H K SHIFT / POS = n; LABEL diameter=’Diameter Cusum’ sample = ’Piston Ring Sample’; TITLE ’Upper One-Sided FIR CUSUM ’; PROC CUSUM DATA=piston; XCHART diameter*sample=’1’ / mu0=74 sigma0=.005 h=4.0 k=0.5 delta=-1.0 dataunits headstart=2 scheme=onesided tablesummary tablecomp haxis=1 TO 25; INSET H K SHIFT / POS = nw; LABEL diameter=’Diameter Cusum’ sample = ’Piston Ring Sample’; TITLE ’Lower One-Sided FIR CUSUM ’; run; 190 FIR CUSUM with Reset after Signal sample xbar n fir cusum_l hsigma cusum_h flag 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 74.0102 74.0006 74.0080 74.0030 74.0034 73.9956 74.0000 73.9968 74.0042 73.9980 73.9942 74.0014 73.9984 73.9902 74.0060 73.9966 74.0008 74.0074 73.9982 74.0092 73.9998 74.0016 74.0024 74.0052 73.9982 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 .004472136 .004472136 .004472136 .004472136 .004472136 .004472136 .004472136 .004472136 .004472136 .004472136 .004472136 .004472136 .004472136 .004472136 .004472136 .004472136 .004472136 .004472136 .004472136 .004472136 .004472136 .004472136 .004472136 .004472136 .004472136 0.000000 0.002754 0.000000 0.000354 0.000000 0.003282 0.002164 0.004246 0.000000 0.000882 0.005564 0.003046 0.003528 0.012210 0.000000 0.006754 0.004836 0.000000 0.000682 0.000000 0.003554 0.000836 0.000000 0.000000 0.005154 .008944272 .008944272 .008944272 .008944272 .008944272 .008944272 .008944272 .008944272 .008944272 .008944272 .008944272 .008944272 .008944272 .008944272 .008944272 .008944272 .008944272 .008944272 .008944272 .008944272 .008944272 .008944272 .008944272 .008944272 .008944272 0.013554 0.003954 0.010836 0.006354 0.008636 0.003118 0.002000 0.000000 0.003082 0.000000 0.000000 0.000282 0.000000 0.000000 0.009354 0.000000 0.000000 0.006282 0.003364 0.011446 0.003154 0.003636 0.004918 0.009000 0.001554 upper FIR CUSUM for Piston-Ring Diameters The CUSUM Procedure 191 upper lower upper upper upper Upper One-Sided FIR CUSUM The CUSUM Procedure Lower One-Sided FIR CUSUM The CUSUM Procedure 192 193 5 5 5 5 5 5 5 5 5 5 5 5 14 15 16 17 18 19 20 21 22 23 24 25 5 9 5 5 8 13 5 7 5 5 6 12 5 5 5 5 4 11 5 3 5 5 2 10 5 1 73.998200 74.005200 74.002400 74.001600 73.999800 74.009200 73.998200 74.007400 74.000800 73.996600 74.006000 73.990200 73.998400 74.001400 73.994200 73.998000 74.004200 73.996800 74.000000 73.995600 74.003400 74.003000 74.008000 74.000600 74.010200 0.01617714 0.00870057 0.01192896 0.00743640 0.00816701 0.00798123 0.00846759 0.00698570 0.01056882 0.00779744 0.00731437 0.01530359 0.01045466 0.00421900 0.00286356 0.00628490 0.00554076 0.01225561 0.00552268 0.00870632 0.01221884 0.00908295 0.01474788 0.00750333 0.01477159 0.00068197 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00068197 0.00000000 0.00545573 0.00737376 0.00509180 0.01220983 0.00352786 0.00304590 0.00556393 0.00088197 0.00000000 0.00424590 0.00216393 0.00328197 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 Decision Cusum Interval 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 73.998200 74.005200 74.002400 74.001600 73.999800 74.009200 73.998200 74.007400 74.000800 73.996600 74.006000 73.990200 73.998400 74.001400 73.994200 73.998000 74.004200 73.996800 74.000000 73.995600 74.003400 74.003000 74.008000 74.000600 74.010200 Subgroup Sample Subgroup sample Size Mean 0.01617714 0.00870057 0.01192896 0.00743640 0.00816701 0.00798123 0.00846759 0.00698570 0.01056882 0.00779744 0.00731437 0.01530359 0.01045466 0.00421900 0.00286356 0.00628490 0.00554076 0.01225561 0.00552268 0.00870632 0.01221884 0.00908295 0.01474788 0.00750333 0.01477159 Subgroup Std Dev 0.01310163 0.01601966 0.01193769 0.01065573 0.01017376 0.01149180 0.00340983 0.00632786 0.00004590 0.00036393 0.00488197 0.00000000 0.00373769 0.00645573 0.00617376 0.01309180 0.01620983 0.01312786 0.01744590 0.01856393 0.02408197 0.02180000 0.01991803 0.01303607 0.01355410 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 0.0089 Decision Cusum Interval Cumulative Sum Chart Summary for diameter Cumulative Sum Chart Summary for diameter Subgroup Std Dev The CUSUM Procedure The CUSUM Procedure Subgroup Sample Subgroup sample Size Mean Upper One-Sided FIR CUSUM Lower One-Sided FIR CUSUM