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
- :
- How to extract fitted line equations?

Topic Options

- Start Article
- 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

Aug 27, 2010 7:42 AM
(6910 views)

I have 60 Bivariate plots and each plot is fitted with a line. How can I extract the line parameter using script?

For example, the fitted line is y=ax+b, how can i get a and b and save them into variables. When i try to use tree structure, it only shows the tree for first plot, and the command to grab values from boxes doesn't work.

Anyone knows how to do that? thanks in advance!

Message was edited by: Schweini

For example, the fitted line is y=ax+b, how can i get a and b and save them into variables. When i try to use tree structure, it only shows the tree for first plot, and the command to grab values from boxes doesn't work.

Anyone knows how to do that? thanks in advance!

Message was edited by: Schweini

1 ACCEPTED SOLUTION

Accepted Solutions

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

This is a somewhat shorter method that uses the built in "make combined data table" command to produce a table containing all the parameters which you can slice and dice as required.

```
//Opendatatable and make report
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = Bivariate(
Y( :weight ),
X( :height ),
Fit Line( {Line Color( "Red" )} ),
By( :age )
);
rbiv = biv << report;
//Combine parameter estimates in new table
dtparms = rbiv[1][tablebox(4)] << make combined data table;
dtparms << Set Name("Parameter Table");
```

3 REPLIES 3

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

Re: How to extract fitted line equations?

A crude, non-script solution is to run regressions, save as text then copy into Excel. Use the text filter function to extract equations from text and copy into new worksheet. Rest can be done with text to columns function. Has to be a better way but this works for me.

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

Re: How to extract fitted line equations?

Here is an example script generating a table with the parameter estimates. The script assumes that the different plots are generated using the "by" command/box in the Bivariate platform.

```
//Open datatable and make report
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = Bivariate(
Y( :weight ),
X( :height ),
Fit Line( {Line Color( "Red" )} ),
By( :age )
);
rbiv = biv << report;
Summarize( groups = by( age ) ); // A list of all by-groups
n = N Items( groups );
//Create output table and fill with estimates
dtOut = New Table( "Regression parameters",
New Column( "Group", Character ),
New Column( "Intercept", numeric ),
New Column( "Slope", numeric ),
addrows( n ));
For( j = 1, j <= n, j++,
Estimates = rbiv[j]["Linear Fit"]["Parameter Estimates"][1][3] << get as matrix;
:Group[j] = groups[j];
:Intercept[j] = Estimates[1];
:Slope[j] = Estimates[2]);
```

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

This is a somewhat shorter method that uses the built in "make combined data table" command to produce a table containing all the parameters which you can slice and dice as required.

```
//Opendatatable and make report
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = Bivariate(
Y( :weight ),
X( :height ),
Fit Line( {Line Color( "Red" )} ),
By( :age )
);
rbiv = biv << report;
//Combine parameter estimates in new table
dtparms = rbiv[1][tablebox(4)] << make combined data table;
dtparms << Set Name("Parameter Table");
```