set ou e vers 2.1 set di p 23 set mo 1 #d ; di _n(5) in w " PROCESS CAPABILITY ANALYSIS USING STATA" _n " ---------------------------------------" _n(2); di in g "In this tutorial, we show how to use Stata to perform a process capability" _n "analysis of a subset of some data in DeVor, Chang & Sutherland (1992). It" _n "consists of (coded) measurements of the inside diameter of machined cylinder" _n "bores obtained in 31 samples, each of size 5. The (coded) lower and upper" _n "specification limits are" in y " 195" in g " and" in y " 203" in g ", respectively." _n(2) "We begin the analysis by using Stata's" in w " xchart" in g " and" in w " rchart" in g " commands to determine" _n "whether the process is in control. If so, we then estimate the following" _n "summary measures:" _n " - process mean and standard deviation" _n " - process capability indices" _n " - fraction nonconforming" _n " - percent yield" _n(2) "We also plot a histogram of the measurements and perform a Shapiro-Wilk test" _n "for normality." _n; di in w ". infile x1-x5 using cylinder.dat"; n inf x1-x5 using cylinder.dat; set mo 0; mor; set mo 1; di _n in w _dup(75) "-" _n in g "First, we " in w "describe" in g " and " in w "list" in g " a portion of our data:" _n in w _dup(75) "-" _n(2) ". describe"; n d; di _n in w ". list in 1/3"; n l in 1/3; set mo 0; mor; set mo 1; di _n(4) in w _dup(79) "-" _n in g "Next, we use Stata's '" in w "rchart" in g "' command to plot an R-chart." _n(2) "Check to see if points fall outside the control limits and whether the plotted" _n "points exhibit a systematic pattern. If so, there is evidence that the process" _n "variation is out of control." _n in w _dup(79) "-" _n(15); di in w ". rchart x1-x5, connect(l)"; set mo 0; mor; cap n rchart x1-x5, connect(l); set mo 1; di _n(5) in w _dup(79) "-" _n in g "Since the R-chart exhibits process control, we next use Stata's '" in w "xchart" in g "'" _n in g "command to plot an Xbar-chart." _n(2) "Check to see if points fall outside the control limits and whether the plotted" _n "points exhibit a systematic pattern. If so, there is evidence that the process" _n "mean is out of control." _n in w _dup(79) "-" _n(15); di in w ". xchart x1-x5, connect(l)"; set mo 0; mor; cap n xchart x1-x5, connect(l); set mo 1; di _n(4) in w _dup(79) "-" _n in g "Both the R-chart and Xbar-chart indicate that the process is in statistical" _n "control. Therefore, we can now estimate the various relevant process" _n "capability summary measures. We have to read in the data again as a single" _n "sample (rather than 31 separate samples)." _n in w _dup(79) "-" _n(12); di in w ". drop _all" _n(2) ". infile x using cylinder.dat"; drop _all; n inf x using cylinder.dat; set mo 0; mor; set mo 1; di _n(5) in w _dup(79) "-" _n in g "We can have a visual assessment of process capability by obtaining a histogram" _n "with lines representing the specification limits inserted. We use Stata's " _n in w "graph" in g " command to obtain the required graphic." _n in w _dup(79) "-" _n(16); di in w ". gr x, bin(8) ylab xlab(192.5,196.5,200.5,204.5,208.5) normal xline(195,203)" _n(2); set mo 0; mor; cap n gr x, bin(8) ylab xlab(192.5,196.5,200.5,204.5,208.5) normal xline(195,203); set mo 1; di _n(5) in w _dup(79) "-" _n in g "From the previous figure, we note that a fairly significant portion of the " _n "histogram extends beyond the specification limits. This is an indication of " _n "poor capability. We can quantify this by computing appropriate process " _n "capabilty indices and other summary statistics but before we do so, we use " _n "Stata's '" in w "swilk" in g "' command to check whether the sample data supports the " _n "hypothesis of a normal probability model for the measurements." _n in w _dup(79) "-" _n(7); di in w ". swilk x" _n(2); n swilk x; set mo 0; mor; set mo 1; di _n(5) in w _dup(79) "-" _n in g "The hypothesis of a normal probability model for the sample measurements" _n "cannot be rejected at the 5 % level of significance." _n(2) "We next use our '" in w "pciest.ado" in g "' program to compute relevant process capability " _n "indices and other summary statistics like fraction nonconforming and percent" _n "yield. This program requires estimates of process mean and standard deviation." _n in w _dup(79) "-" _n(3); di in w " . sum x" _n(2); n sum; di _n(3) in w ". pciest 199.95 2.90, f(195) s(203)" ; set mo 0; mor; set mo 1; n pciest 199.95 2.90, f(195) s(203); di _n(2) in w _dup(79) "-" _n in g "The estimated process mean is close to the mid-point of the specification" _n "range. However, the natural tolerance of the process is greater than the" _n "allowable spread. This implies poor capability and this is reflected in" _n "the values of the estimated capability indices and also in the percent" _n "yield of the process." _n in w _dup(79) "-"; set mo 0; mor; set mo 1; drop _all;