Fit Group and Fit Y by XHello! I'm attempting to script an analysis where the user inputs a data table, and the script runs a fit Y by X with a user selected column through a column dialog box as Y and all other columns (which can be any mix of continuous and nominal variables) as the X selections. Is there a way to use fit Y by X and Fit Group together to get this all-in-one window and easily allow for the results to be ordered by goodness of fit?
This is a script I wrote that outputs them all in one box, but I want the user to easily find the significant fits by ANOVA. Ideally, I would like to output significant fits to a tabular report window, but that is above my knowledge right now. Any help would be appreciated!
Names Default To Here( 1 );
dt = Current Data Table();
dlg = Column Dialog(
iv = ColList( "Depedent Variable",
Min Col( 1 ),
Max Col( 1 ),
Data Type( "Numeric" )
)
);
If( dlg["Button"] != 1,
Beep();
Throw();
);
iv = dlg["iv"];
n_cols = N Cols( dt );
New Window( "Report",
H List Box(
For( c = 1, c <= n_cols, c++,
Fit Y by X(
Y( Column( iv[1] ) ),
X( Column( c ) ),
Fit Line( 1 ),
Anova( 1 )
)
)
)
);
Automation and ScriptingWindowsRe: Fit Group and Fit Y by XThe script below, runs the Fit Y by X and then output the Summary of Fit table for all of the analyses. I hope this is what you want.
Names Default To Here( 1 );
dt = Current Data Table();
dlg = Column Dialog(
iv = ColList( "Depedent Variable",
Min Col( 1 ),
Max Col( 1 ),
Data Type( "Numeric" )//,
//modeling type(ordinal,nominal)
)
);
If( dlg["Button"] != 1,
Beep();
Throw();
);
iv = Char( dlg["iv"][1] );
// Get the names of all of the columns in the data table
colNameList = dt << get column names( string );
// Remove the Dependent Column from the list
Remove From( colNameList, Contains( colNameList, iv ), 1 );
ft = Fit Y by X(
Y( Column( iv ) ),
X( Eval( colNameList ) ),
Fit Line( 1 ),
Anova( 1 )
);
(ft << report)[1]["Summary of Fit", Table Box( 1 )] << make combined data table;
Here are a couple of notes:
- When you post JSL, please use the JSL icon to open the JSL window and copy the code into that window. It allows for a cleaner display of the entry.
- You need to take the time to read the Scripting Guide, which is available in the JMP Documentation Library, under the Help pull down menu.
- The Column Dialog() structure has been depreciated. You need to move to using a New Window with a Col List Box().
Re: Fit Group and Fit Y by XThank you very much!