Bias of Estimator for Cpk

 /****************************************************************/
 /*       S A S   S A M P L E   L I B R A R Y                    */
 /*                                                              */
 /*    NAME: CPKBIAS                                             */
 /*   TITLE: Bias of Estimator for Cpk                           */
 /* PRODUCT: QC                                                  */
 /*  SYSTEM: ALL                                                 */
 /*    KEYS: Capability Analysis, Capability Indices,            */
 /*   PROCS: G3D                                                 */
 /*    DATA:                                                     */
 /*                                                              */
 /*     REF: W. L. Pearn, S. Kotz, N. L. Johnson (1992).         */
 /*          "Distributional and Inferential Properties of       */
 /*          Process Capability Indices".  Journal of Quality    */
 /*          Technology 24, pp. 216-231.                         */
 /*                                                              */
 /*          Rodriguez, R. N. (1992).  (Recent Developments in   */
 /*          Process Capability Analysis".  Journal of Quality   */
 /*          Technology 24, pp. 176-187.                         */
 /*                                                              */
 /*   NOTES: This program calculates the bias for the estimator  */
 /*          of Cpk using results of Pearn et al. (1992).  Also  */
 /*          see page 178 of Rodriguez (1992).  The bias is      */
 /*          compuated as a function of standardized parameters  */
 /*                     d = ( USL - LSL ) / 2                    */
 /*                     | Mu - M |                               */
 /*          where M=(USL+LSL)/2.                                */
 /*                                                              */
 /*    MISC:                                                     */
 /*                                                              */
 /****************************************************************/

 options ps=60 ls=80;

 data cpk;
   label bi = 'Bias'
         ms = '|Mu-M|/Sigma'
         ds = 'd/Sigma';
   keep n ms ds ex bi;
   n = 30;
   f = n-1;
   f1 = (1/3)*sqrt(f/2)*gamma((f-1)/2)*(1/gamma(f/2));
   do ms = 0.0 to 2.0 by 0.05;
      f2 = sqrt(2/n)*(1/gamma(0.5))*exp(-n*0.5*ms*ms);
      f3 = ms*(1-(2*probnorm(-sqrt(n)*ms)));
      do ds = 2 to 6 by 0.05;
         ex = f1*(ds-f2-f3);
         bi = ex - ((ds-ms)/3);
         output;
      end;
   end;
 run;

 title 'Bias of Cpk Estimator for n = 30';
 proc g3d data = cpk;
   plot ds*ms = bi /
     xticknum = 5
     yticknum = 5
     zticknum = 5
     zmin     = -0.05
     zmax     = 0.05
     rotate   = 45
     tilt     = 70
     grid
     ;
 run;

 goptions reset=all;