Subscribe Bookmark RSS Feed

JMP scripting

Community Trekker

Joined:

Dec 16, 2015

I have run 40 regressons which are saved as scripts to the data table.  I would like  to write a script that automatically extracts the R-squared value from each regression and puts them into a table

3 REPLIES

Super User

Joined:

Jun 22, 2012

A couple of questions:

What platform did you use to run the regressions?

Did you run all of the regressions separatly?

Is the question you are asking, that you want to get the table of R-squared values generated from the saved script(s)?

Jim

Community Trekker

Joined:

Dec 16, 2015

Hi,

What platform did you use to run the regressions? I used JMP to run the regressions. Used the contextual X by Y platform

Did you run all of the regressions separatly? Yes I did

Is the question you are asking, that you want to get the table of R-squared values generated from the saved script(s)? This is exactly the question I am asking

Super User

Joined:

Jun 22, 2012

Here is an example script on how to do what you requested.  It has a couple of assumptions.

1. The only scripts saved to the data table are the regression scripts

2. All of the regression scripts used the Fit Y by X platform and produced a "bivariate" output with "Fit Line" option selected.

Names Default To Here( 1 );

dt = Current Data Table();

dtfinal = New Table( "R-Square" );

dtfinal << New Column( "X", character );

dtfinal << New Column( "Y", character );

dtfinal << New Column( "Column 1", character );

dtfinal << New Column( "R-Square" );

scriptNames = dt << get table script names;

For(i=1 , i <= N Items( scriptNames ), i++,

// Wrap an Outline Box around the script so a Handle can be

// attached to allow for referencing inside the analysis

ob = Outline Box( "test", dt << runscript( scriptNames[i] ) );

// Point to the Summary of Fit column and output it as a data table

tempDT = ob["Summary of Fit"][1] << make combined data table;

// Clean up the created data table

tempDT << select where( :Column 1 != "RSquare" );

tempDT << Delete Rows;

tempDT:Column 2 << set name("R-Square");

// Close the analysis

ob << delete;

// Concatenate the outputed table to the final table

dtfinal << concatenate( tempDT, Append to First Table( 1 ) );

// Close the temporary table

Close( tempDT, nosave );

);

Jim