Subscribe Bookmark RSS Feed

How to sort/order bivariate JMP charts based on R-value.

shwetakuvlsi1

Community Trekker

Joined:

Mar 22, 2016

I am doing Regression analysis with 1 Y-axis parameter ( dependent variable) & 100s of X-axis parameters(independent variables) and want to see top correlations ( high R-value) at the top. I get all these charts and apply linear fit but by default, these are sorted alphabetically based on parameter name. Is there a way I can sort these charts in order of decreasing R-value?

5 REPLIES
ian_jmp

Staff

Joined:

Jun 23, 2011

I would take a look at the Response Screening platform:

http://www.jmp.com/support/help/Response_Screening.shtml

which is designed for this kind of thing.

But, if you want to stick with your current method, you can use the kind of approach shown below. Do 'File > New > New Script', copy the code, then 'Edit > Run Script'.

NamesDefaultToHere(1);

// Make some data

nr = 25; // Numer of rows

nc = 21; // Number of columns

m = J(nr, nc, RandomNormal());

cNames = {"Y"}; For(c=2, c<=nc, c++, InsertInto(cNames, "X"||Char(c-1)));

dt = AsTable(m, << ColumnNames(cNames));

dt << setName("Many Xs");

// 'Traditional' Fit Y By X . . .

// (1) Launch the platform invisibly

biv = dt << Bivariate(Y(cNames[1]), X(cNames[2::NItems(cNames)]), FitLine, Invisible);

// (2) Get the R Squared values into an invisible table

dt2 = Report(biv[1])[TableBox(1)] << makeCombinedDataTable(Invisible(1));

r2Del = dt2 << getRowsWhere(:Column 1 != "RSquare");

dt2 << deleteRows(r2del);

dt2 << Sort(By(:Column 2), Order(Descending), ReplaceTable);

// (3) Get the ordering of the Xs by R Squared

xOrder = Column(dt2, "X") << getValues;

// (4) Close the invisible report and table

Report(biv[1]) << closeWindow;

Close(dt2, NoSave);

// (5) Launch the platform with the correct order of Xs

biv = dt << Bivariate(Y(cNames[1]), X(Eval(xOrder)), FitLine);

// Response Screening Platform . . .

Wait(3);

rs = dt << Response Screening( Y(cNames[1]), X(cNames[2::NItems(cNames)]) );

shwetakuvlsi1

Community Trekker

Joined:

Mar 22, 2016

Thanks Ian. I will look into it.

Nate_Riordan

Staff

Joined:

Sep 10, 2015

Hi shwetakuvlsi1,

Are you familiar with the option to "Order by Goodness of Fit".  Using this on sample data such as Football.jmp has the best R-squared at the top and the worst at the bottom.

11201_Screen Shot 2016-03-28 at 2.19.06 PM.png

Here's the sample script to take a look.

dt = Open( "$SAMPLE_DATA/Football.jmp" );

dt << Fit Group(

     Bivariate( Y( :Height ), X( :Weight ), Fit Line ),

     Bivariate( Y( :Height ), X( :LegPress ), Fit Line ),

     Bivariate( Y( :Height ), X( :Neck ), Fit Line ),

     Bivariate( Y( :Height ), X( :Squat ), Fit Line ),

     Bivariate( Y( :Height ), X( :Fat ), Fit Line ),

     Bivariate( Y( :Height ), X( :Bench ), Fit Line ),

     Bivariate( Y( :Height ), X( :Speed ), Fit Line ),

     <<{Arrange in Rows( 1 ), Order by Goodness of Fit},

);

As you have 100's of X's you may want to even turn things into a tabular format using the make combined data table.

11202_Screen Shot 2016-03-28 at 4.50.30 PM.png

And then you can select the R-Squared value:

11203_Screen Shot 2016-03-28 at 4.51.03 PM.png

Regards,

Nate

ian_jmp

Staff

Joined:

Jun 23, 2011

Many thanks, Nate. I certainly overlooked that option, unfortunately!

shwetakuvlsi1

Community Trekker

Joined:

Mar 22, 2016

Thanks Nate. I will explore this option as well.