turn on suggestions

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

Showing results for

- JMP User Community
- :
- Discussions
- :
- Platform Outputs into JSL Variables

Topic Options

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

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

Apr 8, 2014 8:32 AM
(2823 views)

Hello All

Can you pull factors/data/selections from a platform output into JSL?

I have what is currently 2 scripts that I would like to bring together. The first one imports an Excel file and creates a distribution script with "Fit Distribution (All)" so that the user can select the best type of fit and get the parameters. Can I get JSL to read what the user has selected and the parameters? I am thinking that I will need to create a new window via JSL with the distributions and fits (vs right now I send a script to the data table created by opening the Excel file and then run it) and then have a "proceed" button below it. I do not know what to have this button do in order to get what box is selected and the corresponding parameters, or note that no box is selected so I can run a random sampling or discrete sampling via a matrix vs a continuous fit function.

I am doing a Monte Carlo and need each of the types of fit and parameters to do the random function for each.

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions

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

Apr 22, 2014 4:00 PM
(3397 views)

Solution

There seems to exist an internal order of distributions that is maintained whatever the outcome of the automatic sorting. If that order is stable it can be hardcoded like in the example below. However, beware that the number of distributions as well as the order (and spelling?) may change in future versions of JMP.

This code works for me in JMP 11. The selected distributions and parameter estimates are stored in an associative array as keys and values respectively, but there are of course other options (e.g. data tables).

dt = Open**(** "$SAMPLE_DATA/Big Class.jmp" **)**;

dist = Distribution**(** Continuous Distribution**(** Column**(** :weight **)**, Fit Distribution**(** All **)** **)**, Histograms Only **)**;

// List of the distribution names in their "true" order

L = **{**"Normal", "LogNormal", "2 parameter Weibull", "Exponential", "Gamma", "Johnson Su", "Johnson Sl", "Generalized Logarithm", "Extreme Value",

"Normal 2 Mixture", "Normal 3 Mixture"**}**;

rdist = Report**(** dist **)**;

// Add button with script. Click after manual selection.

rdist << **prepend****(**

Button Box**(** "Click when done",

// Find the true position of selected items (not what the automatically sorted table shows)

m = **[]**;

For**(** i = **1**, i <= **11**, i++,

m = m || **(**rdist**[**Outline Box**(** "Compare Distributions" **)][****1****][****1****]** << **get****(** i **))**

**)**;

seldist = If**(** N Row**(** Loc**(** m **)** **)** > **1**,

L**[**Loc**(** m **)]**,

Eval List**(** **{**L**[**Loc**(** m **)]}** **)**

**)**; // Selected distribution(s)

aa = Associative Array**()**; // For storing parameter estimates

// Insert values

For**(** i = **1**, i <= N Row**(** Loc**(** m **)** **)**, i++,

aa << **insertitem****(** seldist**[**i**]**, Matrix**(** rdist**[**Outline Box**(** "Fitted " || seldist**[**i**]** **)][**Number Col Box**(** "Estimate" **)]** << **get** **)** **)**

**)**;

Show**(** Seldist **)**;

Show**(** aa **)**;

**)**

**)**;

7 REPLIES

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

Apr 10, 2014 1:54 PM
(2506 views)

Bump.

I want to get the data in red below back into JSL. I know how to have JSL create the below, but not to get the fit function(s) the user selected and then the paramters for that function back into JSL, for each distribution. Thanks.

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

Apr 22, 2014 1:23 PM
(2506 views)

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

Apr 22, 2014 3:00 PM
(2506 views)

Hi Claus,

I'm still working to figure out how to get which check box is checked.

However, if you're counting on JMP selecting the best fit, since we sort this table by ascending AICc it will always be the first one and something like this will work:

dt=open

("$SAMPLE_DATA/Big Class.jmp");dist= dt <<

Distribution(Continuous Distribution

(Column(:height), Fit Distribution(All))

);r=report

(dist);disttype=r

[outline box("Compare Distributions")][tablebox(1)][StringColBox(1)]<<get(1);paramMatrix=r

[outline box("?"||disttype)][outlinebox(1)][tablebox(1)][numberColBox(1)]<<get as matrix;paramList=r

[outline box("?"||disttype)][outlinebox(1)][tablebox(1)][numberColBox(1)]<<get;show

(disttype, paramMatrix, ParamList);

-Jeff

-Jeff

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

Dec 16, 2017 12:11 PM
(1477 views)

Hi @Jeff_Perkinson. This code has come back to life and I am trying to solve this same problem again. @ms's solution worked in JMP 11 but I cannot get it to work in JMP 13 as the naming convention seems to have changed (as forewarned). Not only has the ordered changed, but it does not seem to be the same between distributions - either in the order they are listed in the GUI (by AICc) or an arbitrary order as @ms found before (as best I can tell, see example below).

Is there a way to see all of the components of a report so I can explore what data is there and see if I can tease out what I need? How did you know that "[tablebox(1)]" or "rdist[Outline Box( "Compare Distributions" )][1][1]" were valid syntaxes? Thanks guys. Apologies for never marking it as an answer.

```
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dist1 = dt << Distribution( Continuous Distribution( Column( :height ), Fit Distribution( All ) ) );
dist2 = dt << Distribution( Continuous Distribution( Column( :weight ), Fit Distribution( All ) ) );
r1 = Report( dist1 );
r2 = Report( dist2 );
m1 = [];
For( i = 1, i <= 11, i++,
m1 = m1 || (r1[Outline Box( "Compare Distributions" )][1][1] << get( i ))
);
m2 = [];
For( i = 1, i <= 11, i++,
m2 = m2 || (r2[Outline Box( "Compare Distributions" )][1][1] << get( i ))
);
show(m1);
show(m2);
```

default values are Weibull for m1 and LogNoraml for m2

m1 = [0 0 0 0 0 0 1 0 0 0 0];

m2 = [0 0 0 0 1 0 0 0 0 0 0];

```
m1 = [];
For( i = 1, i <= 11, i++,
m1 = m1 || (r1[Outline Box( "Compare Distributions" )][1][1] << get( i ))
);
m2 = [];
For( i = 1, i <= 11, i++,
m2 = m2 || (r2[Outline Box( "Compare Distributions" )][1][1] << get( i ))
);
show(m1);
show(m2);
```

change to the second option on each, ExtremeValue for m1 and Gamma for m2

m1 = [0 0 0 0 0 0 0 1 0 0 0];

m2 = [0 0 0 0 0 0 0 1 0 0 0];

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

Dec 18, 2017 5:13 AM
(1457 views)

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

Dec 18, 2017 2:50 PM
(1444 views)

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

Apr 22, 2014 4:00 PM
(3398 views)

There seems to exist an internal order of distributions that is maintained whatever the outcome of the automatic sorting. If that order is stable it can be hardcoded like in the example below. However, beware that the number of distributions as well as the order (and spelling?) may change in future versions of JMP.

This code works for me in JMP 11. The selected distributions and parameter estimates are stored in an associative array as keys and values respectively, but there are of course other options (e.g. data tables).

dt = Open**(** "$SAMPLE_DATA/Big Class.jmp" **)**;

dist = Distribution**(** Continuous Distribution**(** Column**(** :weight **)**, Fit Distribution**(** All **)** **)**, Histograms Only **)**;

// List of the distribution names in their "true" order

L = **{**"Normal", "LogNormal", "2 parameter Weibull", "Exponential", "Gamma", "Johnson Su", "Johnson Sl", "Generalized Logarithm", "Extreme Value",

"Normal 2 Mixture", "Normal 3 Mixture"**}**;

rdist = Report**(** dist **)**;

// Add button with script. Click after manual selection.

rdist << **prepend****(**

Button Box**(** "Click when done",

// Find the true position of selected items (not what the automatically sorted table shows)

m = **[]**;

For**(** i = **1**, i <= **11**, i++,

m = m || **(**rdist**[**Outline Box**(** "Compare Distributions" **)][****1****][****1****]** << **get****(** i **))**

**)**;

seldist = If**(** N Row**(** Loc**(** m **)** **)** > **1**,

L**[**Loc**(** m **)]**,

Eval List**(** **{**L**[**Loc**(** m **)]}** **)**

**)**; // Selected distribution(s)

aa = Associative Array**()**; // For storing parameter estimates

// Insert values

For**(** i = **1**, i <= N Row**(** Loc**(** m **)** **)**, i++,

aa << **insertitem****(** seldist**[**i**]**, Matrix**(** rdist**[**Outline Box**(** "Fitted " || seldist**[**i**]** **)][**Number Col Box**(** "Estimate" **)]** << **get** **)** **)**

**)**;

Show**(** Seldist **)**;

Show**(** aa **)**;

**)**

**)**;