Community Trekker

Joined:

Jan 18, 2015

## How to export values from "Fit group" regression analysis from many variables Y to one X variable?

Hi,

I am interested in testing and comparing the correlation of many (hundreds) of Y variables individually to a single X variable. The "fit Y by X" function seems appropriate.

How do I generate the statistics for each Y variable in a batch, and export them to a data table? Can I apply the saved script to the data table and add the values to the table for instance?

2 ACCEPTED SOLUTIONS

Accepted Solutions

Super User

Joined:

Jun 23, 2011

Solution

## Re: How to export values from "Fit group" regression analysis from many variables Y to one X variable?

Ian's solution here will work.

Here's some sample code:

dt = open("\$sample_data\Car Physical Data.jmp");

biv = dt << Fit Group(

Bivariate( Y( :Weight ), X( :Turning Circle ), Fit Line( {Line Color( {213, 72, 87} )} ) ),

Bivariate( Y( :Weight ), X( :Displacement ), Fit Line( {Line Color( {213, 72, 87} )} ) ),

Bivariate( Y( :Weight ), X( :Horsepower ), Fit Line( {Line Color( {213, 72, 87} )} ) ),

Bivariate( Y( :Weight ), X( :Gas Tank Size ), Fit Line( {Line Color( {213, 72, 87} )} ) ),

<<{Arrange in Rows( 4 )}

);

// A reference to the report layer: bivRep is also a list

bivRep = biv << Report;

// 'Make Combined Data Table' avoids having to message to each item in 'bivRep'

dt2 = bivRep[1][TableBox(2)] << Make Combined Data Table;

dt4 = bivRep[1][TableBox(4)] << Make Combined Data Table;

Community Manager

Joined:

Jun 23, 2011

Solution

## Re: How to export values from "Fit group" regression analysis from many variables Y to one X variable?

There's actually no scripting required here.

You can convert any table in a report into a data table by right clicking on it and choosing Make into Data Table.

If, as in your case, you have lots of analyses in your report window, you can choose Make Combined Data Table which will make one data table that combines all the tables like the one you click on.

Here in the it's sometimes easier to show how to do something by posting a script, but most everything you can do through a script you can do interactively.

-Jeff

-Jeff
3 REPLIES

Super User

Joined:

Jun 23, 2011

Solution

## Re: How to export values from "Fit group" regression analysis from many variables Y to one X variable?

Ian's solution here will work.

Here's some sample code:

dt = open("\$sample_data\Car Physical Data.jmp");

biv = dt << Fit Group(

Bivariate( Y( :Weight ), X( :Turning Circle ), Fit Line( {Line Color( {213, 72, 87} )} ) ),

Bivariate( Y( :Weight ), X( :Displacement ), Fit Line( {Line Color( {213, 72, 87} )} ) ),

Bivariate( Y( :Weight ), X( :Horsepower ), Fit Line( {Line Color( {213, 72, 87} )} ) ),

Bivariate( Y( :Weight ), X( :Gas Tank Size ), Fit Line( {Line Color( {213, 72, 87} )} ) ),

<<{Arrange in Rows( 4 )}

);

// A reference to the report layer: bivRep is also a list

bivRep = biv << Report;

// 'Make Combined Data Table' avoids having to message to each item in 'bivRep'

dt2 = bivRep[1][TableBox(2)] << Make Combined Data Table;

dt4 = bivRep[1][TableBox(4)] << Make Combined Data Table;

Community Trekker

Joined:

Jan 18, 2015

## Re: How to export values from "Fit group" regression analysis from many variables Y to one X variable?

Thank you so much, PMroz, for having taken your time . I just wonder why JMP does not have a simpler way of saving results, especially for those who are not as scripting-savvy as you are, obviously.

Cheers.

Community Manager

Joined:

Jun 23, 2011

Solution

## Re: How to export values from "Fit group" regression analysis from many variables Y to one X variable?

There's actually no scripting required here.

You can convert any table in a report into a data table by right clicking on it and choosing Make into Data Table.

If, as in your case, you have lots of analyses in your report window, you can choose Make Combined Data Table which will make one data table that combines all the tables like the one you click on.

Here in the it's sometimes easier to show how to do something by posting a script, but most everything you can do through a script you can do interactively.

-Jeff

-Jeff