Here is a script that I believe will do what you want. It is setup as an example using the JMP Sample data table called Big Class. However, if you just point the script to the data table you want to run against, and change the Y Var = "age"; to the Y column you want to run against, you should get what you want. There are 2 assumptions with the script.....the first is that all numeric, continuous columns in the data table are to be analyzed, and the second assumption is that the data in the columns are ordered by the X variable. If this is not the case, the script can be modified to handle that situation. It will just add more processing timeāā I changed the script to do the sorting.
Names Default To Here( 1 );
// open the data table
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
Y Var = "age";
// get data into matrices
ColList = dt << get column names( continuous, string );
// Get rid of the Y variable from the list
ColList = Remove( ColList, Contains( ColList, Y Var ), 1 );
// Setup the Lists to contain the determined 10 data points with highest slope
Best Data = {};
Best Ys = {};
Column Names = {};
bestbeta = 0;
startrow = 0;
// Loop across the columns
For( i = 1, i <= N Items( ColList ), i++,
// Sort the data to insure the data is in ascending X
dt << sort( by( Collist[i] ), order( ascending ), replace table( 1 ) );
yall = Column( Y Var ) << getValues;
xall = (Column( dt, collist[i] ) << getValues);
For( k = 1, k <= N Rows( xall ) - 10, k++,
x = xall[k :: k + 9];
x = J( N Row( x ), 1, 1 ) || x;
y = yall[k :: k + 9];
// regression calculations
xpxi = Inverse( x` * x );
beta = xpxi * x` * y;
If( Abs( beta[2] ) > bestbeta,
bestbeta = Abs( beta[2] );
startrow = k;
);
);
Best Data = Best Data || As List( xall[startrow :: startrow + 9] );
Best Ys = Best Ys || As List( yall[startrow :: startrow + 9] );
For( k = 1, k <= 10, k++,
Insert Into( Column Names, ColList[i] )
);
);
// Create the new data table with the best 10 points for all columns
dttogether = New Table( "The Results",
New Column( "Column Name", character, values( Column Names ) ),
New Column( "Y", values( Best Ys ) ),
New Column( "Data", values( Best Data ) )
);
// Create the graphical output
dttogether << color by column( :column name );
Bivariate( Y( :Y ), X( :Data ), Group By( :Column Name ), Fit Line( 1 ) );
Jim