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");

Tuesday, July 28, 2009

Control Chart as a Feedback System: A JMP JSL Demostration

This script was written using SAS JMP's version 5.1.
It demostrates how a control chart can feedback any change in distribution's central tendency and/or measure of dispersion/variation.

For any feedback, kindly send it to me @ rsfrancisco at up dot edu dot com

Regards,
Reynald Francisco



The JMP JSL Script





/*
DETAILS,
>>SIGMA OF THE MEAN IS COMPUTED USING THE CENTRAL LIMIT THEOREM
>>CONTROL LIMITS ARE COMPUTED USING Individuals and Moving Range Method (IMR) in which each mean and sigma of the sample are treated as an individual measure/data point.
>>DATA USED IS A RANDOMLY GENRERATED NORMALLY DISTRIBUTED VARIABLE WITH MEAN = MU (user specified) AND STDEV = SIGMA (user specified).
*/

dlg = Dialog(
V List(V List("Population parameter","",
Line Up(2,
"Mean", mu = Edit Number(0),
"Standard Deviation", sigma = Edit Number(1)
),"","",
"Define Sampling Plan","",
Line Up( 2,
"Sampling Size ",n = Edit Number(5),
"Initial Sub-groups ",m = Edit Number(25)
)
),
H List( Button("OK"), Button("Cancel") )
));


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






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





/*MODULE3*/


dt = New Table( "Process Data" );



col = dt << New Column( "Parameter" );

/* add new column to object 'dt' , which is a data table. Name the new column as "Parameter". Let new column be referred to as new object 'col' */

/*set global constants 'pmean' and 'pSD'*/

pMean = mu;
pSD = sigma;
sigmasample=sigma/sqrt(n);

/*CREATING A MATRIX to contain Normal Random*/




x = J( m, 1, 0 );

For( i=1, i<m+1, i++,
x[i] = mu + sigmasample * Random Normal()
);
musample=0;
For( i=1, i<m+1, i++,
musample=musample + x[i]
);
musample=musample/m;
/* ADDING THE VALUES from the MATRIX into the CREATED COLUMN in the TABLE*/
col << Values( x );

/* CREATE a new window object called 'w' */

w = New Window( "Control Chart Simulation",
H List Box(
(Graph Box(FrameSize(313,313), XScale(mu-6.5*sigma,mu+6.5*sigma), yScale(0,1.10*rsqrt2pi/(sigma/sqrt(n))), Double Buffer,


Handle(mu,rsqrt2pi/sigma,mu=x;sigma=rsqrt2pi/y),

text({musample,rsqrt2pi/sigmasample},"mu_sample= ",musample," \!rsigmasample= ",sigmasample),

sigmasample=sigma/sqrt(n);

Pencolor("blue"),pensize(1), text size(8),TextColor("blue"),

YFunction(Normal Density((x-mu)/sigma)/sigma, x),

text({mu,rsqrt2pi/(pSD/sqrt(n))},"mu= ",mu," sigma= ",(pSD/sqrt(n))),

Pencolor("red"),pensize(1), text size(10),TextColor("red"),
YFunction(Normal Density((x-musample)/(pSD/sqrt(n)))/(pSD/sqrt(n)), x), /*Y-scale is Normalized to Z-scores*/

Pencolor(4),
text({mu,rsqrt2pi/sigmasample},"mu= ",mu," sigma= ",sigmasample),
YFunction(Normal Density((x-mu)/sigmasample)/sigmasample, x) /*Y-scale is Normalized to Z-scores*/
)),



Control Chart(
Sample Label(Empty()),
KSigma(3),
Chart Col(
:Parameter,
Individual Measurement,
Moving Range
),
Show Zones(1),
All Tests(1),

SendToReport(Dispatch({}, "Control Chart", OutlineBox,
Set Title("Control Chart Simulation")),
Dispatch({"Individual Measurement of Parameter"},
"Control Charts", FrameBox, Frame Size(300, 250)),
Dispatch({"Moving Range of Parameter"}, "1",
ScaleBox, {Scale(Linear), Format(Best), Min(4), Max(38), Inc(3),
Minor Ticks(2)}), Dispatch({"Moving Range of Parameter"},
"Control Chart", FrameBox, Frame Size(300, 250)),
Dispatch({"Moving Range of Parameter"},
"Control Charts", FrameBox, Frame Size(80, 90))),

Alarm Script(
Write(
"\!rOut of Control for test ",
qc_test,
" in column ",
qc_col,
" in sample ",
qc_sample
)
)
),

Button Box( "End Simulation",
w << Close Window;
Close( dt, No Save )
)
)
)
;

While( 2,
Wait(1);
dt << Add Rows( 1 );
col[i++] = mu + sigmasample * Random Normal();
);


Monday, July 27, 2009

When Xbar-R wont work...

I am trying to build a case. I want to argue that there are instances that the commonly used control chart Xbar-R does not always work for manufacturing data. This is even when the famous Central Limit Theorem is invoked as a justification of the method.
In here I am developing a JMP JSL to demonstrate it's weaknesses.
I am not yet done, but almost 80% complete. This script is already operational, but not yet as I intended it to be.

Hope you find it useful. I will post the complete blog when I find the time.

Regards,
Reynald Francisco




The JMP JSL Script





Clear Globals();

Run_Num = 1;
//FUNCTIONS

GEN_DATA = Expr(
a = 1;
b = 1;
//Generate Subgroup Means
SubMeans_Matrix = {};
For( a = 1, a <= SubCount, a++,
SubMeans_Matrix[a] = mu + (SigmaBet * Random Normal())
);



a = 1;
b = 1;
i = 1;
NormList = {};
NormTemp = {};
NormData = {};
NormData_b = {};
For( a = 1, a <=SubCount, a++,

b = 1;
For( b = 1, b <= SubSize, b++,
NormTemp[i] = SubMeans_Matrix[a] + (SigmaWith * Random Normal());
NormData_b = NormTemp[i];
NormTemp = {};
NormData = Matrix( NormData );
NormData_b = Matrix( NormData_b );
NormData = NormData || NormData_b;
NormData_b = {};
);
NormList = Matrix( NormList );
NormData = Matrix( NormData );
NormList = NormList |/ NormData;
NormData = {};
);


a = 1;
b = 1;
NormMatrix = Matrix( NormList );


//GENERATE RANDOM DATA;


b = 1;
SigmaWith_Matrix = {};
For( b = 1, b <= SubCount, b++,
SigmaWith_Matrix[b] = (Max( NormMatrix[b, 0] )) - Min( NormMatrix[b, 0] )
);


//sigma = Std Dev( NormMatrix );
//SigmaTot = sigma;
//SigmaWith = Mean(SigmaWith_Matrix)*A2_constant/3;
//SigmaBet = Sqrt( (SigmaTot ^ 2) - (SigmaWith ^ 2) );
SigmaTot_new = SigmaTot;
SigmaWith_new = SigmaWith;


a = 1;
b = 1;
dt = New Table( "Simulation Data-" || Char( Run_Num ) );
m_col = dt << New Column( "Measurement Number", formula( Row() ) );
m_col << set modelling type( ordinal );
For( a = 1, a <= SubSize, a++,
col = dt <<New Column( "Measurement" || Char( a ) );
col << Set Values( NormMatrix[0, a] );
);

Mean_Matrix = {};
a = 1;
b = 1;
For( b = 1, b <= SubCount, b++,
Mean_Matrix[b] = Mean( NormMatrix[b, 0] )
);
Mean_Matrix = Matrix( Mean_Matrix );
col = dt << New Column( "Average Measurement" );
col << Set Values( Mean_Matrix );

SigmaWith_Matrix = Matrix( SigmaWith_Matrix );
col = dt << New Column( "Measurement Range" );
col << Set Values( SigmaWith_Matrix );

Run_Num = Run_Num + 1;
dt <<Select All Rows;
dt << colors( 5 );
dt << markers( 8 );
); //END OF EXPRESSION: GEN_DATA


GEN_CHART = Expr(
OUT_WINDOW << Append(
CChat = Panel Box( "Resulting Control Chart",
Overlay Plot(
X( :Measurement Number ),
Y( :Average Measurement ),
Y Axis[1] << {{Scale( Linear ), Format( "Best" ), Min(
Col Mean( Column( "Average Measurement" ) ) - 1.10 * A2_constant * Col Mean( Column( "Measurement Range" ) )
), Max(
Col Mean( Column( "Average Measurement" ) ) + 1.10 * A2_constant * Col Mean( Column( "Measurement Range" ) )
), Inc( 1 ), Add Ref Line(
Col Mean( Column( "Average Measurement" ) ) - A2_constant * Col Mean( Column( "Measurement Range" ) ),
Solid,
Dark Red
), Add Ref Line(
Col Mean( Column( "Average Measurement" ) ) + A2_constant * Col Mean( Column( "Measurement Range" ) ),
Solid,
Dark Red
), Add Ref Line( Col Mean( Column( "Average Measurement" ) ), Dashed, Red )}},
Separate Axes( 1 ),
Connect Points( 1 ),
:Average Measurement( Connect Color( 21 ) ),
SendToReport(
Dispatch( {}, "Overlay Plot", OutlineBox, Set Title( "Control Chart for Simulated Data-" || Char( Run_Num ) ) )
),
SendToReport(
Dispatch(
{},
"106",
ScaleBox,
{Scale( Linear ), Format( "Fixed Dec", 3 ), Min(
Col Mean( Column( "Average Measurement" ) ) - 1.10 * A2_constant *
Col Mean( Column( "Measurement Range" ) )
), Max(
Col Mean( Column( "Average Measurement" ) ) + 1.10 * A2_constant *
Col Mean( Column( "Measurement Range" ) )
), Inc( Round( (2 * A2_constant * Col Mean( Column( "Measurement Range" ) )) / 20, 2 ) )}
),
Dispatch(
{},
"101",
ScaleBox,
{Scale( Linear ), Format( "Best" ), Min( 0.5 ), Max( SubCount + 0.5 ), Inc( 1 ), Minor Ticks( 0 ),
Rotated Labels( 1 )}
),
Dispatch(
{},
"Overlay Plot",
FrameBox,
{Frame Size( 840, 300 ), DispatchSeg( LineSeg( 1 ), {Line Color( "Medium Dark Blue" )} )}
)
)
)
)//END OF GRAPH BOX
);//END OF NEW WINDOW

Run_Num = Run_Num + 1;
);//END OF EXPRESSION GEN_CHART


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

//Define Subgrouping (limit from 2-9 for XbarR charts)
//Define intial average
//Define initial Sigma within
//Get user information through a dialog box



SamplingSizes = {"2", "3", "4", "5", "6", "7", "8", "9"};
SubgroupSizes = {"20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35"};

dlg = Dialog(
"When Xbar-R will not work: A JMP demonstration",
" ",
"Enter the following information to begin",
" ",
V List(
V List(
" Population parameter:",
"",
Line Up( 2, " Mean", mu = Edit Number( 0 ), " Standard Deviation", sigma = Edit Number( 1 ) ),
"",
"",
" Define Sampling Plan:",
"",
H LIST(
V LIST( " Subgroup Size ", H LIST( " ", n = Combo Box( SamplingSizes ) ) ),
" ",
V LIST( " Number of Subgroups ", H LIST( " ", m = Combo Box( SubgroupSizes ) ) )
)
)
),
" ",
H List( Button( "OK" ), Button( "Cancel" ) )
);


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




SubSize = Match( n, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9 );
SubCount = Match( m,
1, 20,
2, 21,
3, 22,
4, 23,
5, 24,
6, 25,
7, 26,
8, 27,
9, 28,
10, 29,
11, 30,
12, 31,
13, 32,
14, 33,
15, 34,
16, 35
);

A2_constant = Match( SubSize, 2, 1.8806, 3, 1.0231, 4, 0.7286, 5, 0.5768, 6, 0.4833, 7, 0.4193, 8, 0.3725, 9, 0.3367 );

SigmaTot = sigma;
SigmaWith = (SigmaTot / A2_constant) / 3;
SigmaBet = Sqrt( (SigmaTot ^ 2) - (SigmaWith ^ 2) );



/**********************************CODE OUTPUT INTERFACE*********************************************/


//Define the output window
OUT_WINDOW = New Window( "When Xbar-R will not work: A JMP demonstration",
Border Box(
TOP( 5 ),
Left( 5 ),
Panel Box( "MOVE THE SLIDER BOXES BELOW TO ADJUST THE RELATIVE VALUES OF SIGMAS:",
V List Box(
H List Box(
V List Box(
NormCurve = Graph Box(
FrameSize( 500, 300 ),
Y Scale( 0, y = 0.8 * rsqrt2pi / (sigma / Sqrt( SubSize )) ),
X Scale( mu - 10.0 * sigma, mu + 10.0 * sigma ),
Double Buffer,
Pen Size( 2 );
Pen Color( "red" );
Text Color( "red" );
Text( {mu + 2.0 * SigmaTot, 0.5 * y}, "Sigma Total" );
Y Function( Normal Density( ((x - mu) / SigmaTot) ), x );
Pen Color( "blue" );
Text Color( "blue" );
Text( {mu + 2.5 * SigmaWith, 0.1 * y}, "Sigma Within" );
Y Function( Normal Density( ((x - mu) / SigmaWith) ), x );
Pen Color( "green" );
Text Color( "green" );
Text( {mu + 3.0 * SigmaBet, 0.3 * y}, "Sigma Between" );
Y Function( Normal Density( ((x - mu) / SigmaBet) ), x );
),


H List Box(
Text Color( "black" );
T1 = Text Box( " SIGMA BETWEEN: " );,
SB1 = Slider Box(
0.5 * SigmaTot,
10 * SigmaTot,
SigmaBet,
SigmaTot = Sqrt( SigmaWith ^ 2 + SigmaBet ^ 2 );
NormCurve << reshow;
Tri << reshow;
SB2 << reshow;


);
),
H List Box(
Pen Color( "blue" );
T2 = Text Box( " SIGMA WITHIN: " );,
SB2 = Slider Box(
0.5 * SigmaTot,
10 * SigmaTot,
SigmaWith,
//SIGMA_WIDTH_EXPR;
SigmaTot = Sqrt( SigmaWith ^ 2 + SigmaBet ^ 2 );
NormCurve << reshow;
Tri << reshow;
SB1 << reshow;
)
);



),
Tri = Graph Box(
framesize( 300, 300 ),
X Scale( -0.5, 10.5 * SigmaTot ),
Y Scale( -0.50, 10.5 * SigmaTot ),
XCOR = {0, SigmaWith, 0, 0};
YCOR = {0, 0, SigmaBet, 0};
XCOR = Matrix( XCOR );
YCOR = Matrix( YCOR );
Pen Color( "Gray" );
Fill Color( "Gray" );
Polygon( XCOR, YCOR );
Pen Size( 2 );
Pen Color( "blue" );
Line( {SigmaWith, 0}, {0, 0} );
Pen Color( "green" );
Line( {0, 0}, {0, SigmaBet} );
Pen Color( "red" );
Line( {0, SigmaBet}, {SigmaWith, 0} );
)
),
Text Box( " " ),
H List Box(
Panel Box( "COMMAND OPTIONS",
V List Box(
Button Box( "GENERATE SIMULATED DATA", GEN_DATA ),
Button Box( "GENERATE SIMULATED DATA AND CHARTS",
GEN_DATA;
Run_Num = Run_Num - 1;
GEN_CHART;
Out_Window << Bring Window To Front;
)
)
),
Panel Box( "HELP OPTIONS",
V List Box(
Button Box( "ABOUT THE AUTHOR", Caption( "wala pa" ) ),
Button Box( "HELP LINKS", Caption( "WALA PA" ) )
)
),
Panel Box( "OTHER OPTIONS",
V List Box(
Button Box( "EXIT", OUT_WINDOW << CLOSE WINDOW ),
Button Box( "WWW.SIXSIGMAPRACTICE.COM", Web( "WWW.SIXSIGMAPRACTICE.COM" ) )
)
)
)//END OF HLIST
) //END OF BORDER BOX
) //END OF END OF PANEL BOX
) // END OF BORDER BOX
);//END OF NEW WINDOW OUT_WINDOW
T1 << font color( "GREEN" );
T2 << font color( "BLUE" );
Show( NormCurve );
NormCurve << reshow;
Tri << reshow;

Out_Window << Bring Window To Front;


Sunday, July 26, 2009

Chebyshev's Inequality to Roughly Estimate Area Under an Unknown Probability Density Curve: Reposted from www.SixSigmaPractice.multiply.com

I have always been fascinated by this generalized area under the curve theorem.
Though the estimate in itself is very weak, Chebyshev's inequality provides a very strong statistical basis for control charting.
Here is a utility that compares the actual area under the curve against to that estimated by Chebyshev's inequality.


The JMP JSL Script




Clear Globals();
new=EXPR(dt=open());
use_curr=expr(dt=Current Data Table());
if(is empty(Current Data Table()),new,use_curr);
bound=1.5;
j = 1;
col_list = {};
For( j = 1, j <= N Col( dt ), j++,
col_list[j] = Column( j ) << get name
);


COMM_RUN = Expr(
col = Column( col_name );
modelling=col<<get modeling type;
CONT=EXPR(
val1 = col << get as matrix;
counter = N Rows( val1 );
T_counter = 0;
mu = Mean( val1 );
sigma = Std Dev( val1 );
i = 1;
For( i = 1, i <= counter, i++,
If( val1[i, 1] <= mu + bound * sigma & val1[i, 1] >= mu - bound * sigma,
T_counter = T_counter + 1;
i = i + 1;
,
i = i + 1
)
);

Actual = T_counter / counter * 100;
T_estimate = (1 - (1 / (bound ^ 2))) * 100;
);
NON_CONT=EXPR(Throw ("Data Column does not contain a continous variable data"));
if(modelling=="Continuous",CONT,NON_CONT);
);

COMM_PRINT = Expr(
PRINT_TEXT = "Actual area inside mean +/- " ||char(bound) || "*sigma is " || Char( round(Actual,2) ) || " while Chebyshev's inequality estimate is " || Char( round(T_estimate,2) );
PRINT_VALUES = "Mean is equal to " ||char(round(mu,3)) || ". Sigma is equal to " ||char(round(sigma,3)) || ". The bounded interval is equal to " ||char(round(mu-bound*sigma,3)) || " to " ||char(round(mu+bound*sigma,3)) || ".";
Print( PRINT_VALUES );
Print( PRINT_TEXT );
);


COMM_OUTPUT = Expr(
OUTPUT_REPORT = New Window( "Results",
Border Box(
Left( 10 ),
Panel Box( "Simulation Result for " || char(col),
Text Box(" "),
V LIST BOX(
Text Box( "" ),
Text Box( PRINT_VALUES ),
Text Box( " " ),
Text Box( PRINT_TEXT ),
Text Box(" "),
Text Box( "sixsigmapractice.multiply.com" )
)
)
)
)
);

New Window( "Interface",
Border Box(
Left( 10 ),
Panel Box( "Set values and click on RUN",
V List Box(
V List Box(
H List Box(
Text Box( "Set Bound = k" ),
Text Box( " " ),
combo_list = Combo Box(
{"1.5", "2", "2.5", "3", "3.5", "4", "4.5", "5", "5.5", "6"},
COMBO_COMM = Expr(
k = combo_list << getselected;
bound = Num( k );
);
COMBO_COMM;
),

),
Text Box( " " ),
H List Box(
Text Box( "Select Column" ),
Text Box( " " ),
col_select = Combo Box( col_list ),
COL_COMM = Expr( col_name = col_select << get );
COL_COMM;
)
),
Text Box( " " ),
Panel Box( "Command Button",
Button Box( "RUN ESTIMATE",
COMBO_COMM;
COL_COMM;
COMM_RUN;
COMM_PRINT;
COMM_OUTPUT;
OUTPUT_REPORT << reshow;
OUTPUT_REPORT<<move window(250,50)
)
)
)
)
)
);

Sigma Level as a Measure of Process Capabiltity (Reposted from www.SixSigmaPractice.multiply.com

There are many available measures of Process Capability.
In fact anything that relates process variation to specification
limits,and measures how often the process meets these specifications can be considered as a measure of Process Capability.
Process Capability can be measured either by Percent Yield, Percent Defect, Cp, Pp, Cpk, Ppk, or Sigma Level. This JSL script uses JMP's graphical capability to demostrate how the standard Normal Curve defines the relationships between the Sigma Level, percent Yield, and percent defect.
 
Note: You may use freely but the author will appreciate it the author will be given credit, and this webpage will be sited.
Reynald Francisco
http://www.sixsigmapractice.multiply.com/



The JMP JSL Script

When the JMP script is run, an initial dialog box would prompt the user the input initial values as shown below.
Input Dialog Box:




The output image is a graph as shown below:




The JMP JSL Script is shown below::

dlg = Dialog(
V List(
V List(
"ENTER THE FOLLOWING INFORMATION:",
"",
V List(
"Input Option",
V List(
TestType = Radio
Buttons( "YIELD RATE", "DEFECT RATE", "SIGMA LEVEL" ),
Line Up( 2, "Input
Value ", x = Edit Number( 0.5 ) )
)
),
"",
"Note: Input Yield
Rate and Defect Rate in decimal format."
),
H List( Button( "OK" ),
Button( "Cancel" ) )
)
);

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

If(
TestType != 3 & x >= 1,
Caption( "Input Yield Rate
and Defect Rate in decimal format. Right click to close message." );
Throw(
"User cancelled" );,
TestType != 3 & x <= 0,
Caption( "Input
value is not valid. Right click to close message." );
Throw( "User
cancelled" );,
TestType == 3 & x < 0,
Caption( "Input value is
not valid. Right click to close message." );
Throw( "User cancelled" );
);

mu = 0;
sigma = 1;
rsqrt2pi = 1 / Sqrt( 2 * Pi() );

If(
TestType == 3, SigmaLevel = x,
TestType == 1, SigmaLevel =
Normal Quantile( x ),
TestType == 2, SigmaLevel = Normal Quantile( 1 - x )
);

New Window( "Sigma Level Demostration",
Graph Box(
FrameSize( 900, 500 ),
X Scale( -10, 10 ),
Y Scale( 0, 0.5 ),
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*/
If( TestType == 2,
Y
Function( Normal Density( (x - mu) / sigma ) / sigma, x, fill( 1 ), Min(
SigmaLevel ) ),
Y Function( Normal Density( (x - mu) / sigma ) / sigma, x,
fill( 1 ), Max( SigmaLevel ) )
);
Pen Color( "red" );,
Pen Size( 1
),
Text Size( 10 ),
Text Color( "black" ),
X Function( SigmaLevel, y
);
Handle( SigmaLevel, 0.45 * rsqrt2pi / sigma, SigmaLevel = x );
Text
Color( "black" );
Text( {SigmaLevel, 0.45 * rsqrt2pi / sigma}, "<--Move
this point" );
Text Color( "red" );
Text( {SigmaLevel, 0.55 * rsqrt2pi /
sigma}, "Sigma Level= ", SigmaLevel );
Pen Color( "blue" );,
Pen Size( 1
),
Text Size( 11 ),
Text Color( "blue" ),
Z = (SigmaLevel - mu) /
sigma;
Yield = Normal Distribution( Z );
Defect = (1 - Yield);
Text(
{mu, 1.15 * rsqrt2pi / sigma}, "YIELD= ", yield * 100, "%" );
Text( {mu,
1.05 * rsqrt2pi / sigma}, "DEFECT= ", defect * 100, "%" );
) /* Close Graph
Box parenthesis*/
); /* Close New Window parenthesis*/





Saturday, July 11, 2009

Extending Your JMP's Capability Thru Scripting

If your are a JMP user do you know that you can increase your JMP's capability by leaps and bounds through scripting?

Yes you can! I do create scipts which utilities range from an ordinary alarm clock, mail sender, matrix solver, to report generator, and so on. Some of my work are shared online and can be found here:
http://sixsigmapractice.multiply.com/

http://www.sas.com/apps/demosdownloads/jmpFileExchange_PROD__sysdep.jsp?packageID=000416&jmpflag=Y&searchvar=userName&searchval=Reynald%20Francisco

In my multiply account, i do post many JSL scripts. In here i will try to foucs more on teaching how to script.

Till next entry!
 
Custom Search