From RegressIt to R and back

RegressIt has a novel interface for exchanging models with the R programming language, which allows you to take advantage of the analysis options of both environments.

There are

The Generate-R-Code dialog box is shown on a separate page, and it offers you the following options:

In all of the options that involve fitting multiple models, a table of summary statistics of all models is produced, and it is automatically copied to the clipboard for pasting into the Excel file if desired.

There is also a tool for exporting your data from Excel to an R data frame if the latter is not already open in your Rstudio session.

RegressIt has a novel interface for exchanging models with the R programming language, which allows you to take advantage of the analysis options of both environments.

**You can run a regression model in R with no writing of R code, nor even any knowledge of how to write R code.**It is written for you by RegressIt and stored in a script file which can be executed immediately by hitting paste-enter at the command prompt in R. The script file also leaves an audit trail and could be edited later if you wish. The models you run in R can start from selections of variables that were used in models previously fitted with RegressIt, but they don't have to.**You can use RegressIt purely as a menu-driven front end for linear and logistic regression in R, generating R code from an Excel file that contains no regression model worksheets.**Even if you are not ordinarily an Excel user, this could be helpful when building models with very large numbers of variables, so that no editing of long equations is needed in R. You may also want to use the Excel file as a repository for R code, as described below.There are

**3 different ways in which to select variables in RegressIt**for a model that you want to run in R.- Hit the
**Export R Code**button while positioned on an existing model worksheet in order to re-use the same variables in R. - Launch the regression procedure from any worksheet, select the variables you want to use (if they have not been preselected), check the
**R-code-only box,**then hit Run. - Run the descriptive analysis procedure and use the option to produce a
**table of correlations and squared correlations versus the first variable only**. Then use this table for selecting variables to be used for the R model, perhaps after sorting it first on the correlations. If you launch the regression procedure from this worksheet, it will preselect all variables that have not been de-selected by using the Remove button on the ribbon, and the R-code-only box will pass them along to R.

**You can also go the other way.**Having fitted a model in R, you can instantly re-run the same model in RegressIt by copying and pasting the multiline lm(.) or glm(.) model equation from the R output onto an Excel worksheet and then launching RegressIt's linear regression procedure while the cursor is positioned on the code. You may want to include an extra worksheet in the Excel file (positioned to the right of all RegressIt worksheets) to be a repository for R code that can be used to re-run models in either RegressIt or R. You could re-launch a model in R from this worksheet without also running the model in RegressIt, via the R-code-only option.The Generate-R-Code dialog box is shown on a separate page, and it offers you the following options:

- A choice between linear and logistic regression for the dependent and independent variables selected in RegressIt.
- An a-la-carte selection of table and chart output.
- A choice between using all variables or a subset chosen by forward or backward stepwise selection, with or without tracing the steps in the output produced.
- A variety of options for training and testing, all of which can be combined any variable selection method:

- Fit a single model to all data or a subset thereof with no out-of-sample testing
- Fit a single model to a specified subset of the data and test on another subset (not necessarily all-other)
- Perform k-fold cross-validation using an integer variable in the Excel file to define the folds.
- Fit models to disjoint subsets of the data (with the sets defined by an integer variable in the Excel file) with or without testing each one on the rest of the data.
- Fit models to random subsets of the data (with a choice of how much data to hold out and how many iterations to run) and test each one on the remaining data

In all of the options that involve fitting multiple models, a table of summary statistics of all models is produced, and it is automatically copied to the clipboard for pasting into the Excel file if desired.

There is also a tool for exporting your data from Excel to an R data frame if the latter is not already open in your Rstudio session.

*Altogether it takes just a few clicks and keystrokes to transfer data and models from RegressIt to R or to transfer models from R back to RegressIt*