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

- 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

Jun 29, 2018 5:00 PM
(7376 views)

Hi all,

Is there a way to save the R-Square value from the smoothing spline fit in JSL? I'd like to be able to reference it at a later point.

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

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

The Output Display's Tree Structure for the output you are looking for, is different than the example I gave. If you right click on the gray triangle beside the Bivariate Fit of NPN1 By PNP1 outline box(), and then select

Edit==>Show Tree Structure

You can see the Tree Structure for all of the output.

Below is the script using your output

```
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
biv = Bivariate(
Y( :NPN1 ),
X( :PNP1 ),
Fit Spline( 100000, {Line Color( {204, 121, 41} )}, {Save Predicteds})
);
// Offset into the report object and get the RSquare value
RSquare = (Report(biv)["Smoothing Spline Fit, lambda=100000"][NumberColBox(1)]<<get)[1] ;
```

Jim

8 REPLIES 8

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

Re: Saving R-Square values from smoothing spline fit

All display data in an output table from a JMP platform is available to JSL. Here is a simple example that retrieves the Smoother RSquare value

```
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
biv = Bivariate(
Y( :NPN1 ),
X( :PNP1 ),
Kernel Smoother( 1, 1, 0.343642611683849, 0 )
);
// Offset into the report object and get the RSquare value
RSquare = Num(Report(biv)["Local Smoother"][numberbox(1)]<<get text);
```

Jim

Highlighted
##

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

Re: Saving R-Square values from smoothing spline fit

Thanks for the reply Jim. The example you gave helps a bit, but it doesn't work exactly the same for a Fit Spline(). What's the problem with the syntax in the following..

```
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
biv = Bivariate(
Y( :NPN1 ),
X( :PNP1 ),
Fit Spline( 100000, {Line Color( {204, 121, 41} )}, {Save Predicteds})
);
// Offset into the report object and get the RSquare value
RSquare = Num(Report(biv)["Smoothing Spline Fit, lambda=100000"][numberbox(1)]<<get text);
```

The error implies a problem with the numberbox(1).

Highlighted
##

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

Re: Saving R-Square values from smoothing spline fit

The R-square value is contained in a number col box in this case, not a number box. You find the container for the value you want by viewing the tree structure. See this page for instructions on that: https://www.jmp.com/support/help/14/view-the-display-tree.shtml

You just need to replace the last line with this:

`RSquare = (Report(biv)["Smoothing Spline Fit, lambda=100000"][numbercolbox(1)]<< Get)[1];`

The << Get message to the number col box will return a list of values. You can alternatively use "<< Get As Matrix". The [1] returns the first list item, which is the R-squared value.

-- Cameron Willden

Highlighted
##

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

Re: Saving R-Square values from smoothing spline fit

Thanks for the help!

Highlighted

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

The Output Display's Tree Structure for the output you are looking for, is different than the example I gave. If you right click on the gray triangle beside the Bivariate Fit of NPN1 By PNP1 outline box(), and then select

Edit==>Show Tree Structure

You can see the Tree Structure for all of the output.

Below is the script using your output

```
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
biv = Bivariate(
Y( :NPN1 ),
X( :PNP1 ),
Fit Spline( 100000, {Line Color( {204, 121, 41} )}, {Save Predicteds})
);
// Offset into the report object and get the RSquare value
RSquare = (Report(biv)["Smoothing Spline Fit, lambda=100000"][NumberColBox(1)]<<get)[1] ;
```

Jim

Highlighted
##

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

Re: Saving R-Square values from smoothing spline fit

Thanks for the help Jim!

Highlighted
##

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

Re: Saving R-Square values from smoothing spline fit

If I add a "by(:SITE)" in the "Bivariate" function, then I will have five plots in the report. How can I extract all five Rsquare value and save it as a new column in the table?

Thanks,

Zihao

Highlighted
##

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

Re: Saving R-Square values from smoothing spline fit

Created:
Dec 4, 2018 1:33 PM
| Last Modified: Dec 4, 2018 1:45 PM
(6743 views)
| Posted in reply to message from Zihao 12-04-2018

The Bivariate Platform creates a separate tree structure for each of the By levels. To access the RSquare value, all that has to be done, is to point to the RSquare value as in the single Bivariate execution, but to add a subscript for which one of the RSquares outputs you want. Below is a simple modification to the script, to place the RSquare values for all 5 sites into a new data table

```
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
biv = Bivariate(
Y( :NPN1 ),
X( :PNP1 ),
Fit Spline( 100000, {Line Color( {204, 121, 41} )}, {Save Predicteds} ),
by( :site )
);
// Offset into the report object and get the RSquare value
RSquare = {};
For( i = 1, i <= N Items( biv ), i++,
Insert Into(
RSquare,
(Report( biv[i] )["Smoothing Spline Fit, lambda=100000"][Number Col Box( 1 )]
<< get)[1]
)
);
dtRSquare = New Table( "RSquareTable", New Column( "RSquares", values( RSquare ) ) );
```

To fully understand how to deal with the Output Display Trees created by JMP, strongly suggest that you read the section on Display Trees in the Scripting Guide

Help==>Books==>Scripting Guide

Jim

Article Labels

There are no labels assigned to this post.