cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • See how to interactively organize and restructure data for analysis. Register for May 29 webinar, 2pm US ET.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
KG
KG
Level I

Script- Extracting spec limits from distribution process capability

I am attempting to write a script (JMP 16.0) to select columns from a dataset, create distributions, do a continuous fit “ALL” and generate process capability on the best fit (see below).

What I am having issues with is figuring out how to generate a table with characteristics of the distributions, specifically the generated spec limits.  Also I am having difficulty combining all the distributions to a single window. Any pointers would greatly be appreciated, I have tried looking into scriptable object documentation without any luck.

 

file = Current Data Table ();
TableList = List ();
For (i = 1, i <= NTable(), i++,
     TableList [i] = Data Table (i) << Get Name
);
ColSelect = Column Dialog (
     Column Use = ColList ("Add", Max Col (N Col()))
);
For (i = 1, i <= N Items(ColSelect["ColumnUse"]), i++,
    colName = ColSelect ["ColumnUse"] [i] << Get Name;
     obj = file << Distribution(
         Continuous Distribution(Column(Eval(colName)), Fit ALL)
     );
     specLimits = obj << (Fit Handle["best"] << Process Capability( Set Sigma Multiplier for Quantile Spec Limits( 3 ), show limits ));
      );
1 REPLY 1

Re: Script- Extracting spec limits from distribution process capability

How about the following script? Hope it helps.

file = Open("$SAMPLE_DATA/Cities.jmp");
ColSelect = Column Dialog( Column Use = ColList( "Add", Max Col( N Col() ) ) );
If( ColSelect["Button"] != 1,
	Throw();
);

spec limit aa = Associative Array();

nw = New Window( "Combined Results",
	H List Box(
		For( i = 1, i <= N Items( ColSelect["ColumnUse"] ), i++,
			colName = ColSelect["ColumnUse"][i] << Get Name;
			obj = file << Distribution(
				Continuous Distribution( Column( Eval( colName ) ), Fit ALL )
			);

			rpt = obj << report;
			best dist = rpt[Outline Box( "Compare Distributions" )][Table Box( 1 )][
			String Col Box( 1 )] << get( 1 );

			Eval(
				Eval Expr(
					obj << (Fit Handle[Expr( best dist )] <<
					Process Capability( Set Sigma Multiplier for Quantile Spec Limits( 3 ) ))
				)
			);

			spec limits = rpt[Outline Box( "Process Capability" )][
			Outline Box( "Process Summary" )][Table Box( 1 )][Number Col Box( 1 )] << get;
			spec limit aa[colName] = Eval List( {spec limits, best dist} );
		)
	)
);

//Save to New Data Table
result dt = New Table( "Results" );
colnames = spec limit aa << get keys;

result dt << addmultiplecolumns( "key", N Items( colnames ), Numeric );

For( i = 1, i <= N Col( result dt ), i++,
	Column( result dt, i ) << set name( colnames[i] )
);

result dt << addrows( 5 );

For( j = 1, j <= N Col( result dt ), j++,
	For Each Row(
		i = Row();
		Try( result dt[i, colnames[j]] = spec limit aa[colnames[j]][1][i] );
	)
);

Recommended Articles