//////////A JSL script (JSL = JMP's Scripting Language) that demonstrates Sigma Level Computation////////

//////////Created by Reynald Francisco, posted in http://elsmar.com/Forums //////// //////////////

///Copy and Paste in JMP's script editorm then press CTRL-R

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.

*/

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

Text( {SigmaLevel, 0.45 * rsqrt2pi / sigma}, "<<--Move Handle to change values");

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*/