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!
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] ;
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);
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).
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.
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