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
- :
- 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
(5026 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

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

Re: JSL: Getting Inputs to JSL from Distribution Platform Outputs for Monte Carlo

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

Re: Platform Outputs into JSL Variables

Changed title to see if I can get some help. The data has to be there, but I have not been able to get it. I have tried playing with the "Show Properties" function when creating the display window, but cannot figure out how to pull back what is checked and the the parameter values. If I was creating my own check box list and table I could get them, but not with JMP doing it... Creating it myself is not an option as I need the platform to do the work.

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

Re: Platform Outputs into JSL Variables

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

Re: Platform Outputs into JSL Variables

Dec 16, 2017 12:11 PM
(3680 views)
| Posted in reply to message from Jeff_Perkinson 04/22/2014 06:00 PM

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

Re: Platform Outputs into JSL Variables

Regarding the question "Is there a way to see . . . " then, once you have a report window open, right click on an outline node and select 'Edit > Show Tree Structure'. You might also like to review threads about 'XPath', such as this one.

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

Re: Platform Outputs into JSL Variables

Thanks @ian_jmp. That tree structure helps me understand with what I am playing. I got lost on the XPath feature, but that link took me to 'Get XML' which has been helpful as well. The problem I run in to is that the order of 0/1 that come from '...[checkboxbox(1)]<<get(i)' do not line up with the values from '...[StringColBox(1)]<<get(i)'. More so the checkbox results are not consistent across variables. What logic am I missing?

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

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

**)**

**)**;