Thursday, July 30, 2009

Process Capability Measures Cp and Cpk: A JMP JSL Demostration

I am often asked about the diffence between Cp and Cpk. Usually it is followed up by a question on why there is a need for two measures. I then answer that while Cpk is the real capability, Cp reflects the potential capability that can still be achieved just by centering your process. This is a difficult concept to grasp if just verbally described, so I usually illustrate this using a graphical demostration.
This JMP script demostrates the differences between the two Process Capability Measures Cp and Cpk.


The JMP JSL Script




dlg = Dialog(
V List(
V List(
"Cp Parameters",
"",
Line Up( 2,
/*"Mean", mu = Edit Number(0),*/
"Standard Deviation", sigma = Edit Number( 1 )
),
"",
"",
"Define Specifications",
"",
Line Up( 2, "USL ", upspecs = Edit Number( 2 ) ),
Line Up( 2, "LSL ", lowspecs = Edit Number( -2 ) )
),
H List( Button( "OK" ), Button( "Cancel" ) )
)
);


If( dlg["Button"] == -1,
Throw( "User cancelled" )
);
Remove From( dlg );
Eval List( dlg );


/*ADDED line for Cp only*/
LSL = lowspecs;
USL = upspecs;
mu = lowspecs + (upspecs - lowspecs) / 2;
mid = (upspecs - lowspecs);
/*END of added line*/


rsqrt2pi = 1 / Sqrt( 2 * Pi() );

New Window( "Process Capability Demostration",
V List Box(
H List Box(
Panel Box( "Cpk Window",
T1=Text Box ("Move the Handle in the curve to change the value of the Mean"),
g1 = Graph Box(
FrameSize( 425, 400 ),
X Scale( mu - 8 * sigma, mu + 8 * sigma ),
Y Scale( 0, 1.40 * rsqrt2pi / sigma ),
Double Buffer,
Pen Color( "blue" ),
Pen Size( 1 ),
Text Size( 12 ),
Text Color( "black" ),
Y Function( Normal Density( (x - mu) / sigma ) / sigma, x ); /*Y-scale is Normalized to Z-scores*/
Y Function(
Normal Density( (x - mu) / sigma ) / sigma,
x,
fill( 20 ),
Max( LSL )
); /*Fill low*/
Y Function(
Normal Density( (x - mu) / sigma ) / sigma,
x,
fill( 20 ),
Min( USL )
); /*Fill high*/
Pen Color( "red" );,
Pen Size( 1 ),
Text Size( 10 ),
Text Color( "black" ),
X Function( LSL, y );
Handle( mu, rsqrt2pi / sigma, mu = x;g2<<reshow; );
g2 << reshow;
Handle( LSL, 0.45 * rsqrt2pi / sigma, LSL = x );
g2 << reshow;
Handle( USL, 0.45 * rsqrt2pi / sigma, USL = x );
X Function( USL, y );
delta = mu - LSL;
Text( {mu, 0.85 * rsqrt2pi / sigma}, "mu ", mu, " sigma ", sigma );
Text Color( "red" );
Text( {LSL, 0.45 * rsqrt2pi / sigma}, "LSL= ", LSL );
Text( {USL, 0.55 * rsqrt2pi / sigma}, "USL= ", USL );
Pen Color( "blue" );,
Pen Size( 1 ),
Text Size( 11 ),
Text Color( "blue" ),
Cp = (USL - LSL) / (6 * sigma);
Cpu = (USL - mu) / (3 * sigma);
Zu = (USL - mu) / sigma;
Zl = (LSL - mu) / sigma;
yield = Normal Distribution( Zu ) - Normal Distribution( Zl );
Cpl = (mu - LSL) / (3 * sigma);
Cpk = Min( Cpu, Cpl );
Text( {mu, 1.25 * rsqrt2pi / sigma}, "Cpk= ", Cpk );
Text( {mu, 1.15 * rsqrt2pi / sigma}, "Cp= ", Cp );
Text( {mu, 1.05 * rsqrt2pi / sigma}, "Estimated Yield= ", yield );
) /* Close Graph Box parenthesis*/
),
Panel Box( "Cp Window",
T2=Text Box ("Move the Handle in the curve to change the value of the Sigma");,
g2 = Graph Box(
FrameSize( 425, 400 ),
X Scale( mu - 8 * sigma, mu + 8 * sigma ),
Y Scale( 0, 1.40 * rsqrt2pi / sigma ),
Double Buffer,
Handle( mu, rsqrt2pi / sigma, sigma = rsqrt2pi / y; g1<<reshow; );
delta = mu - LSL;
USL2 = mu + delta;
Pen Color( "red" );,
Pen Size( 1 ),
Text Size( 10 ),
Text Color( "black" ),
X Function( LSL, y );
X Function( USL2, y );
Text( {mu, 0.85 * rsqrt2pi / sigma}, "mu ", mu, " sigma ", sigma );
Text Color( "red" );
Text( {LSL, 0.45 * rsqrt2pi / sigma}, "LSL= ", LSL );
Text( {USL2, 0.55 * rsqrt2pi / sigma}, "USL= ", USL2 );
Pen Color( "blue" );,
Pen Size( 1 ),
Text Size( 11 ),
Text Color( "blue" ),
Cpu = (USL2 - mu) / (3 * sigma);
Zu = (USL2 - mu) / sigma;
Zl = (LSL - mu) / sigma;
yield2 = Normal Distribution( Zu ) - Normal Distribution( Zl );
Cpl = (mu - LSL) / (3 * sigma);
Cp2 = (USL2 - LSL) / (6 * sigma);
Text( {mu, 1.15 * rsqrt2pi / sigma}, "Cp= ", Cp2 );
Text( {mu, 1.05 * rsqrt2pi / sigma}, "Estimated Yield= ", yield2 );
Pen Color( "blue" );,
Pen Size( 1 ),
Text Size( 12 ),
Text Color( "black" ),
Y Function( Normal Density( (x - mu) / sigma ) / sigma, x ); /*Y-scale is Normalized to Z-scores*/
Y Function(
Normal Density( (x - mu) / sigma ) / sigma,
x,
fill( 20 ),
Max( LSL )
); /*Fill low*/
Y Function(
Normal Density( (x - mu) / sigma ) / sigma,
x,
fill( 20 ),
Min( USL2 )
); /*Fill high*/
)
)
)
)/*END Of BORDER BOX*/
); /* Close New Window parenthesis*/

T1<<Text Color("BLUE");
T2<<Text Color("BLUE");

No comments:

Post a Comment

 
Custom Search