Thursday, August 6, 2009

Cp vs Cpk: Illustrating the Impact of Mean Shift and Sigma Changes

This is a script I developed to help me in explaining the concepts of Cp/Pp and Cpk/Ppk whenever I am conducting Six Sigma trainings. This is one of the reasons I appreciate JMP's JSL. It allows me to customize demostrations for my trainees that visually aid them in grasping Six Sigma concepts.
You may freely use. I would be grateful if you would give the credit to me and refer to this blog.

Reynald Francisco
http://statisticalprocesscontrols.blogspot.com/



The JMP JSL Script




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


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






rsqrt2pi = 1/sqrt(2*pi());

New Window("Cpk Demostration",

Graph Box(
FrameSize(500,500),
XScale(mu-8*sigma,mu+8*sigma),
yScale(0,1.40*rsqrt2pi/sigma),
Double Buffer,
Pencolor("blue"),
pensize(1),
text size(12),
TextColor("black"),
YFunction(Normal Density((x-mu)/sigma)/sigma, x); /*Y-scale is Normalized to Z-scores*/
YFunction(Normal Density((x-mu)/sigma)/sigma, x,fill(20),max(LSL)); /*Fill low*/
YFunction(Normal Density((x-mu)/sigma)/sigma, x,fill(20),min(USL)); /*Fill high*/
Handle(mu,rsqrt2pi/sigma,mu=x;sigma=rsqrt2pi/y);
Pencolor("red"),
pensize(1),
text size(10),
TextColor("black"),
XFunction(LSL, y);
Handle(LSL,0.45*rsqrt2pi/sigma,LSL=x);
XFunction(USL, y);
Handle(USL,0.55*rsqrt2pi/sigma,USL=x);
text({mu,0.85*rsqrt2pi/sigma},"mu ",mu," sigma ",sigma);
textcolor("red");
text({LSL,0.45*rsqrt2pi/sigma},"LSL= ",LSL);
text({USL,0.55*rsqrt2pi/sigma},"USL= ",USL);
Pencolor("blue"),
pensize(1),
text size(11),
TextColor("blue"),
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.15*rsqrt2pi/sigma},"Cpk= ",Cpk);
text({mu,1.35*rsqrt2pi/sigma},"Cpu= ",Cpu);
text({mu,1.25*rsqrt2pi/sigma},"Cpl= ",Cpl);
text({mu,1.05*rsqrt2pi/sigma},"Estimated Yield= ",yield);
) /* Close Graph Box parenthesis*/
); /* Close New Window parenthesis*/

No comments:

Post a Comment

 
Custom Search