Showing posts with label sas. Show all posts
Showing posts with label sas. Show all posts

Thursday, September 10, 2009

Analysis of Means (ANOM) in JMP

This is in response to the query sent to me regarding on how to do an Analysis of Means in JMP. For those who are not familiar with this method, you can refer to this SAS link regarding the definition and history of the Analysis of Means, and to this presentation for the technical details. With regards to how to do Analysis of Means in Minitab, refer to this video.

How to do Analysis of Means (ANOM) in JMP

From the 2005 Winter issue of JMPer cable (issue 16) it says that "ANOM is not a standard procedure in JMP. However, scripts generate ANOM decision charts for comparing means with either equal or unequal sample sizes.You can download these scripts at http://www.jmp.com/news/jmpercable. The script for equal sample sizes is named ANOMB.jsl and the script for unequal sample sizes is named ANOMUB.jsl."

The JMP JSL Scripts

Here are the JMP scripts that are downloadable from SAS JMP's website.
JMP's Analysis of Means for Equal Sample Sizes
Clear Globals();
R = Column Dialog(
 Resp = Col List( "Y, Response",
  Data Type( Numeric ),
  Min Col( 1 ),
  Max Col( 1 )
 ),
 Treat = Col List( "X, Treatment",
  Min Col( 1 ),
  Max Col( 1 )
 ),
 V List(
  "Alpha",
  SL = Radio Buttons( "0.1", "0.05", "0.01", "0.001" )
 )
);

If( r["Button"] == -1, Throw( "User cancelled" ) );

TN = Column( R["Treat"] );
RN = Column( R["Resp"] );
SigLevel = R["SL"];

alpha = {0.1, 0.05, 0.01, 0.001};

Summarize(
 a = By( TN ),
 c = Count,
 mean Response = Mean( RN ),
 stdev Response = Std Dev( RN )
);
Ymin = Min( mean Response );
Ymax = Max( mean Response );

k = N Items( a );
K1 = Log( k );
K2 = Log( k-2 );
a1 = a[1];

tc = Sum(c);
MSEnum=summation(i=1, k, (stdev Response[i]^2));
nu = tc - k;
MSE = MSEnum / k;

Insert Into( a, "Total" );
c|/= tc;
mean Response |/= (tmeanY = Col Mean( RN ));
stdev Response |/= Col Std Dev( RN );
 
Include( "Exact Factors for ANOM.JSL" );

Show(SigLevel);
Show(alpha);
PMP = h(SigLevel, k, nu) * Sqrt( MSE ) * Sqrt( (k-1) / tc );

UDL = tmeanY + PMP;
LDL = tmeanY - PMP;

cc = Control Chart(
 Sample Size( TN ),
 KSigma(3),
 Chart Col( RN,
  XBar(
   Needle(1),
   Connect Points(0),
   Show Control Limits(0)
  )
 )
);

ccr = cc << Report;

ccr[TextBox(3)] <<Delete;

ccr[AxisBox(2)] << Max( k+1 );

ccr[FrameBox(1)] << Add Graphics Script(
 Pen Color( 3 );
 H Line( LDL );
 H Line( UDL );
);

ccr[OutlineBox(2)] << Prepend(
 tb = Text Box( "alpha = " || Char( alpha[SigLevel] ) )
);

ccr[OutlineBox(2)] << Prepend(
 tb2 = Text Box( "LDL = " || Char( Round(LDL, 2) )  )
);


ccr[OutlineBox(2)] << Prepend(
 tb3 = Text Box( "UDL = " || Char( Round(UDL, 2) )  )
);

updateChart = Expr(
 PMP = h(SigLevel, k, nu) * Sqrt( MSE ) * Sqrt( (k-1) / tc );
 UDL = tmeanY + PMP;
 LDL = tmeanY - PMP;
 ccr[PictureBox(1)] << Reshow;
 tb << Set Text( "alpha = " || Char( alpha[SigLevel] ) );
 tb2 << Set Text( "LDL = " || Char( Round(LDL, 2) )  );
 tb3 << Set TExt( "UDL = " || Char( Round(UDL, 2) )  );
);

ccr << Append(
 OutlineBox( "Analysis of Means",
  H List Box(
   Button Box( "alpha = 0.1",
    SigLevel = 1;
    updateChart;
   ),
   Button Box( "alpha = 0.05",
    SigLevel = 2;
    updateChart;
   ),
   Button Box( "alpha = 0.01",
    SigLevel = 3;
    updateChart;
   ),
   Button Box( "alpha = 0.001",
    SigLevel = 4;
    updateChart;
   )
  ),
  Outline Box( "Means/Standard Deviations",
   Table Box(
    String Col Box( "Treatment", a ),
    Number Col Box( "Count", c ),
    Number Col Box( "Mean", mean Response ),
    Number Col Box( "Std Dev", stdev Response )
   )
  )
 )
);

JMP's Analysis of Means for Un-Equal Sample Sizes
Clear Globals();

R = Column Dialog(
 Resp = Col List( "Y, Response",
  Data Type( Numeric ),
  Min Col( 1 ),
  Max Col( 1 )
 ),
 Treat = Col List( "X, Treatment",
  Min Col( 1 ),
  Max Col( 1 )
 ),
 V List(
  "Alpha",
  SL = Radio Buttons( "0.1", "0.05", "0.01", "0.001" )
 )
);

If( r["Button"] == -1, Throw( "User cancelled" ) );

TN = Column( R["Treat"] );
RN = Column( R["Resp"] );
SigLevel = R["SL"];

alpha = {0.1, 0.05, 0.01, 0.001};

Summarize(
 a = By( TN ),
 c = Count,
 mean Response = Mean( RN ),
 stdev Response = Std Dev( RN )
);
Ymin = Min( mean Response );
Ymax = Max( mean Response );

k = N Items( a );
K1 = Log( k );
K2 = Log( k-2 );
a1 = a[1];

tc = Sum(c);
MSEnum = Summation( i=1, k, ((c[i]-1)*stdev Response[i]^2) );
nu = tc - k;
MSE = MSEnum / nu;

Insert Into( a, "Total" );
c |/= tc;
mean Response |/= (tmeanY = Col Mean( RN ));
stdev Response |/= Col Std Dev( RN );
 
Include( "Exact Factors for ANOMUB.JSL" );

Show( SigLevel );
Show( alpha );

PMP = {};

UDL = {};
LDL = {};

For( i=1, i<k+1, i++, Insert Into( PMP, m(SigLevel, k, nu) * Sqrt(MSE)*Sqrt((tc - c[i])/(tc*c[i]))));
For( i=1, i<k+1, i++, Insert Into( UDL, tmeanY + PMP[i]));
For( i=1, i<k+1, i++, Insert Into( LDL, tmeanY - PMP[i]));

cc = Control Chart(
 Sample Size( TN ),
 KSigma(3),
 Chart Col( RN,
  XBar(
   Needle(1),
   Connect Points(0),
   Show Control Limits(0)
  )
 )
);

ccr = cc << Report;

ccr[TextBox(3)] << Delete;

ccr[AxisBox(2)] << Max( k+1 );

For( i=1, i<k+1, i++,
 Eval(
  Substitute(
   Expr(
    ccr[FrameBox(1)] << Add Graphics Script(
     Pen Color( 3 );
     H Line( sss, eee, LDL[iii] );
     H Line( sss, eee, UDL[iii] );
    );
   ),
   Expr( sss ),
   i - 0.5,
   Expr( eee ),
   i + 0.5,
   Expr( iii ),
   i
  )
 );
);

ccr[OutlineBox(2)] << Prepend(
 tb = Text Box( "alpha = " || Char( alpha[SigLevel] ) )
);

ccr[OutlineBox(2)] << Prepend(
 tb2 = Text Box( "LDL = " || Char( Round(LDL, 2) )  )
);


ccr[OutlineBox(2)] << Prepend(
 tb3 = Text Box( "UDL = " || Char( Round(UDL, 2) )  )
);

updateChart = Expr(
 For(i=1, i<k+1, i++, PMP[i]=m(SigLevel, k, nu)* Sqrt(MSE)*Sqrt((tc - c[i])/(tc*c[i])));
 For(i=1, i<k+1, i++, UDL[i]= tmeanY + PMP[i]);
 For(i=1, i<k+1, i++, LDL[i] = tmeanY - PMP[i]);

 ccr[PictureBox(1)] <!<! Reshow;
 tb << Set Text( "alpha = " || Char( alpha[SigLevel] ) );
 tb2 << Set Text( "LDL = " || Char( Round(LDL, 2) )  );
 tb3 << Set TExt( "UDL = " || Char( Round(UDL, 2) )  );
);

ccr << Append(
 OutlineBox( "Analysis of Means",
  H List Box(
   Button Box( "alpha = 0.1",
    SigLevel = 1;
    updateChart;
   ),
   Button Box( "alpha = 0.05",
    SigLevel = 2;
    updateChart;
   ),
   Button Box( "alpha = 0.01",
    SigLevel = 3;
    updateChart;
   ),
   Button Box( "alpha = 0.001",
    SigLevel = 4;
    updateChart;
   )
  ),
  Outline Box( "Means/Standard Deviations",
   Table Box(
    String Col Box( "Treatment", a ),
    Number Col Box( "Count", c ),
    Number Col Box( "Mean", mean Response ),
    Number Col Box( "Std Dev", stdev Response )
   )
  )
 )
);

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

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