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
- :
- JMP 7: Convert slope and intercept from regression analysis to table 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

Nov 24, 2011 7:58 AM
(3818 views)

How can I extract the slope and the intercept coming from a linear least squares model to a table variable? I want to use both values for additional calculations.

Thanks,

Helge

1 ACCEPTED SOLUTION

Accepted Solutions

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

I assume you want a scripting solution. One way to do it is extract the numbers numbercolbox in the display tree that holds the parameter estimates. In the Fit Model report it is the first numeric column in the "Parameter Estimates" outline box. Below is an jsl example. I don't have access to JMP7, but it works in JMP9.

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

ls_fit = Fit Model**(**

Y**(** :weight **)**,

Effects**(** :height **)**,

Personality**(** Standard Least Squares **)**,

Emphasis**(** Effect Leverage **)**,

Run**(**

:weight << **{**Plot Actual by Predicted**(** **1** **)**, Plot Residual by Predicted**(** **1** **)**,

Plot Effect Leverage**(** **1** **)}**

**)**

**)**;

intercept = Report**(** ls_fit **)[**"Parameter Estimates"**][**Number Col Box**(** **1** **)][****1****]**;

slope = Report**(** ls_fit **)[**"Parameter Estimates"**][**Number Col Box**(** **1** **)][****2****]**;

dt << new table variable**(** "intercept", intercept **)**;

dt << new table variable**(** "slope", slope **)**;

7 REPLIES

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

I assume you want a scripting solution. One way to do it is extract the numbers numbercolbox in the display tree that holds the parameter estimates. In the Fit Model report it is the first numeric column in the "Parameter Estimates" outline box. Below is an jsl example. I don't have access to JMP7, but it works in JMP9.

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

ls_fit = Fit Model**(**

Y**(** :weight **)**,

Effects**(** :height **)**,

Personality**(** Standard Least Squares **)**,

Emphasis**(** Effect Leverage **)**,

Run**(**

:weight << **{**Plot Actual by Predicted**(** **1** **)**, Plot Residual by Predicted**(** **1** **)**,

Plot Effect Leverage**(** **1** **)}**

**)**

**)**;

intercept = Report**(** ls_fit **)[**"Parameter Estimates"**][**Number Col Box**(** **1** **)][****1****]**;

slope = Report**(** ls_fit **)[**"Parameter Estimates"**][**Number Col Box**(** **1** **)][****2****]**;

dt << new table variable**(** "intercept", intercept **)**;

dt << new table variable**(** "slope", slope **)**;

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

Many thanks for this fast answer, but I fear that JMP7 does not support this kind of solution. I get this error message:

Can't subscript Display Box in access or evaluation of 'Subscript' , Report( ls_fit )["Parameter Estimates"]

I will have to update to the recent version.

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

Ok, maybe there has been som changes in the tree structure. But I don't think you woud have to upgrade only to solve this problem (altough JMP 9 is a compelling upgrade for other reasons).

Try to replace the lines for intercept and slope in the above code with:

intercept = Report**(** ls_fit **)[**Outline Box**(** "Parameter Estimates" **)][**Number Col Box**(** **1** **)][****1****]**;

slope = Report**(** ls_fit **)[**Outline Box**(** "Parameter Estimates" **)][**Number Col Box**(** **1** **)][****2****]**;

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

Unfortunately, this doesnt work neither.

Get the same error message as before:

Can't subscript Display Box in access or evaluation of 'Subscript', Report ( ls_fit) ["Parameter Estimates"]

[/*###*/"Parameter Estimates"][....

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

After including a

show properties (ls_fit)

into the script, it becomes clear from the output that the individual items in the report are not listed as scriptable.

The samples given in the current JMP scripting guide do not work either.

I therefore assume that version 7 is not able to access the values inside the Parameter Estimates. I have to install version 9.

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

I don't know if I really understand your problem, but after a linear fit (also any other) in a scatter plot you get a table with parameter estimtes. I can right-click on the table an chose "make into table" which makes a new JMP table.

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

Meanwhile I updated to JMP 9 and got my problem fixed. The script I use is:

//____________________________________________________________________

dt = currentDataTable ();

ls_fit = Bivariate(

Y( :Tau ),

X( :Name( "Concentration in g/mL" ) ),

Fit Line( {Line Color( "Red" )} ),

SendToReport( Dispatch( {}, "Bivar Plot", FrameBox, Frame Size( 250, 250 ) ) )

);

Intercept = Report( ls_fit )["Parameter Estimates"][Number Col Box ("Estimate")][1];

Slope = Report( ls_fit )["Parameter Estimates"][Number Col Box("Estimate")][2];

// The variables exist already in the table.

dt << set table variable( "Intercept", char (Intercept) );

dt << set table variable( "Slope", char (Slope) );

//_________________________________________________________________________

Thus, the first answer by MS was already the solution to my problem (except for the fact that I had to include the "char" statement).

Now I can use the slope and the intercept in a quite complicated equation to calculate automatically the parameter I want to have (particle size in this case).

Thanks to all who helped!