*! pciest--compute process capability indices from summary statistics *! version 1.0.0 July 4, 1993 STB17: sqc1 program define pciest version 3.0 par "`*'", p(" ,") loc mean `1' loc sd `2' if "`5'"=="" { #d ; di in r _n(2) "Input is as follows:" _n(2) "pciest mean sd, f(#) t([l|u]) s(#)" _n(2) "mean - REQUIRED estimate of process mean" _n "sd - REQUIRED estimate of process std dev" _n "f(#) - REQUIRED first spec limit #" _n "t([l|u]) - spec limit type (only for case of one spec)" _n "s(#) - second spec limit # (only for case of two specs)" _n; #d cr e 100 } conf n `mean' conf n `sd' ma s ma s loc options "Fsl(real 1.0) Type(string) Ssl(real 1.0)" par "`*'" if "`type'"=="l" { loc lsl = `fsl' loc cpl = (`mean'-`lsl') / (3*`sd') loc phat = normprob((`lsl'-`mean')/`sd') #d ; di in g _n(2) _col(10) "LSL = " in y %9.4f `lsl' _n in g _n(2) _col(10) "CPL = " in y %9.4f `cpl'; #d cr ma de S_1 = `cpl' } else if "`type'"=="u" { loc usl = `fsl' loc cpu = (`usl'-`mean') / (3*`sd') loc phat = normprob((`mean'-`usl')/`sd') #d ; di in g _n(2) _col(10) "USL = " in y %9.4f `usl' _n in g _n(2) _col(10) "CPU = " in y %9.4f `cpu' ; #d cr ma de S_1 = `cpu' } else { loc lsl = min(`fsl',`ssl') loc usl = max(`fsl',`ssl') loc cp = (`usl'-`lsl') / (6*`sd') loc cpk = min((`mean'-`lsl'),(`usl'-`mean'))/(3*`sd') loc phat = (normprob((`lsl'-`mean')/`sd') /* */ + normprob( (`mean'-`usl')/`sd')) #d ; di in g _n(2) _col(10) "LSL = " in y %9.4f `lsl' in g _col(40) "USL = " in y %9.4f `usl' _n in g _n(2) _col(10) "Cp = " in y %9.4f `cp' in g _col(40) "Cpk = " in y %9.4f `cpk' _n in g _n(2) _col(10) "(LSL+USL)/2 = " in y %9.4f (`lsl'+`usl')/2 in g _col(40) "(USL-LSL)/6 = " in y %9.4f (`usl'-`lsl')/6 ; #d cr ma de S_1 = `cp' ma de S_2 = `cpk' } #d ; di in g _n(2) _col(10) "Mean = " in y %9.4f `mean' in g _col(40) "Std Dev = " in y %9.4f `sd' _n in g _n(2) _col(10) "p = " in y %9.4f `phat' in g _col(40) "Yield (%) = " in y %9.4f (1-`phat')*100 _n(2) ; #d cr end