Choose Language Hide Translation Bar
Highlighted
shampton82
Level III

Set spec limits for K sigma macro

I use the "Distribution" platform along with "Set Spec Limits for KSigma" alot for getting suggested spec limits for non-normal data.  Workflow is Distribution->assign a distribution->process capability in the distribution out put-> Set Spec limits for K Sigma.  This can become a long process when you have lots of columns.

 

Ideally I'd be able to assign the right distribution and then have a macro that would loop through each column and make the "Set Limit..." output.  I see that there is an example script for this functionality but it has a hard coded distribution and it also appears to only apply it to all columns.

 

It appears my first hurdle, which seems silly, is trying to get the assigned distribution from in the distribution platform so I can replace the hard coding of it (LogNormal in this example):

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Cities.jmp" );
obj = Distribution( Column( :CO ) );
obj << Fit Distribution( LogNormal( Set Spec Limits for KSigma( 3 ) ) );

I was thinking of using something like  current report()["Distributions"]<< get scriptable object;

to be able use the code for the open distribution analysis and then I have to figure out how to loop through the columns in the open distribution.

 

The other option I was thinking about was assigning the distributions as a column property and pulling from that and running a bunch of individual analysis but I didn't see code to go that route either.

 

Thanks for any ideas!!

 

Steve

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Set spec limits for K sigma macro

You are mixing new fitters with legacy fitters.  The code needs to be completely different for the new fitters.  Below is some example code for the new fitters.

dt = Open( "$SAMPLE_DATA/Cities.jmp" );
obj = dt<<Distribution(
	Continuous Distribution( Column( :CO ), Fit Exponential ),
	Continuous Distribution( Column( :SO2 ), Fit Gamma )
);
obj<<(Fit Handle[1]<<Process Capability( Set Sigma Multiplier for Quantile Spec Limits( 3 ) ) );

View solution in original post

9 REPLIES 9
Highlighted
Georg
Level IV

Re: Set spec limits for K sigma macro

"Show tree structure" May help you to adress the proper Position in the report.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Cities.jmp" );
obj = Distribution( Column( :CO ) );
obj << Fit Distribution( LogNormal( Set Spec Limits for KSigma( 3 ) ) );

obj << show tree structure;

 

Georg
Highlighted

Re: Set spec limits for K sigma macro

If you only have one fit per response, you can use the following:

obj<<(Fit Handle[1]<<( Set Spec Limits for KSigma( 3 ) ) );

Highlighted
shampton82
Level III

Re: Set spec limits for K sigma macro

Thanks Tonya!

 

That works really well.  However, it only appears to work if I have one column in the Distribution Analysis.  Is there something I need to change to have it work when I have multiple columns in the analysis?  If I have more than one it doesn't work; no error but also nothing happens.

 

The script from the sample library will run with multiple columns (though it is a hard coded distribution choice).

 

Steve

Highlighted

Re: Set spec limits for K sigma macro

It worked for me with multiple columns.

dt = Open( "$SAMPLE_DATA/Cities.jmp" );
obj = Distribution( Column( :CO, :POP ) );
obj << Fit Distribution( exponential ) ;
obj<<(Fit Handle[1]<<( Set Spec Limits for KSigma( 3 ) ) );
Highlighted
shampton82
Level III

Re: Set spec limits for K sigma macro

It would probably help if I included my script:

Names Default To Here( 1 );
dt=Current Data Table();
ex=current report()["Distributions"]<< get scriptable object;
ex<<(Fit Handle[1]<<( Set Spec Limits for KSigma( 3 ) ) );

Ideally I would run the distribution platform, select my distribution for each column, then run this script to set all the spec limits.

 

So this works, but only if I have one column in the Distribution Analysis.

 

Steve

Highlighted

Re: Set spec limits for K sigma macro

The code works fine for me if I have more than 1 column in distribution.

dt = Open( "$SAMPLE_DATA/Cities.jmp" );
obj = Distribution(
	Continuous Distribution(
		Column( :CO ),
		Fit Distribution(
			Exponential
		)
	),
	Continuous Distribution( Column( :POP ), Fit Distribution( Gamma) )
);
ex=current report()["Distributions"]<< get scriptable object;
ex<<(Fit Handle[1]<<( Set Spec Limits for KSigma( 3 ) ) );
Highlighted
shampton82
Level III

Re: Set spec limits for K sigma macro

Thanks for looking at this some more Tonya.

I agree the code you supplied works but it looks to work because you are assigning the distributions through the macro first.  If I remove the distributions and re add them manually and then just try and run the last two lines of the macro it doesn't work.

 

What I found interesting was that the fitted distributions had the name "Fitted Exponential" vs "Fitted Exponential Distribution" that shows up when I manually assign it.  So it got me thinking and....I can make it work if I use the legacy fits!  So if I enable the legacy fitters, fit the distributions manually, and then run the last two lines it works perfectly.

 

So maybe there needs to be a script modification to be able to work with the new fit functionality that showed up in 15?

 

Steve

 

 

 

Highlighted

Re: Set spec limits for K sigma macro

You are mixing new fitters with legacy fitters.  The code needs to be completely different for the new fitters.  Below is some example code for the new fitters.

dt = Open( "$SAMPLE_DATA/Cities.jmp" );
obj = dt<<Distribution(
	Continuous Distribution( Column( :CO ), Fit Exponential ),
	Continuous Distribution( Column( :SO2 ), Fit Gamma )
);
obj<<(Fit Handle[1]<<Process Capability( Set Sigma Multiplier for Quantile Spec Limits( 3 ) ) );

View solution in original post

Highlighted
shampton82
Level III

Re: Set spec limits for K sigma macro

That did it, turns out that part of the issue was of my own doing.  I didn't realize that Handle[1] was to the first distribution in the list order (Normal, Cauchy, Lognormal, etc), not the first distribution in the AIC ordered table.  So the macro would run and I wouldn't see anything because it had been applied to the Normal distribution and that was hidden. If I changed Handle[1] to Handle["best"] then it worked with the best chosen distribution.

 

Final code was simply this (though I learned a lot!)  Thanks again for all the help Tonya!

Names Default To Here( 1 );
dt=Current Data Table();

pf=current report()["Distributions"]<< get scriptable object;

pf<<(Fit Handle["best"]<<Process Capability( Set Sigma Multiplier for Quantile Spec Limits( 3 ) ) );

 

Article Labels