Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

- JMP User Community
- :
- Discussions
- :
- Set spec limits for K sigma macro

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Set spec limits for K sigma macro

Sep 13, 2020 6:52 PM
(165 views)

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

7 REPLIES 7

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

- Tags:
- s

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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