R Modeling now Possible in SPSS Modeler

October 26th, 2015
Brad Miller
Information Architect

Embedded in the last version of SPSS Modeler 17, we can now find R nodes to execute R scripts.

Here we show you how to make it possible:

1. Add a User Input node, from the Sources palette, to the stream canvas and select the bankloan.sav data set, located in the Demas folder.

2. Add an R Transform node, from the Record Ops palette, to the stream canvas, and connect it to the User Input node.

3. Double-click the R Transform node to open the node dialog box.

4. In the R Transform Syntax field, on the Syntax tab, enter the following R script:

Two variables were created and added to the dataframe.

Click OK

5. Add a Type node, from the Field Ops palette, to the stream canvas, and connect it to the R Transform node.

6. Set the variable “default” as the target and read values to load data from the 2 new variables and Click OK.

7. Add a Data Audit node, from Output palette, and impute values on the target variable. (Optional)

8. Add another Type node after the filter (generated node). (Optional)

9. Add an R Building node, from the Modeling palette, to the stream canvas, and connect it to the Type node.

10. Double-click the R Building node to open the node dialog box.

11. In the R model building syntax field, on the Syntax tab, enter the following R script:

12. In the R model scoring syntax field, on the Syntax tab, enter the following R script:

In the Model Options tab, select Display R graphs as HTML and Display R text output. Customize the model’s name by selecting the radio button (Custom option) on the top.

Hit RUN!

13. Check the console output, in the building node, to check for errors.

14. Double click on the golden node generated by the building model node.

15. Click on the Graph output tab, and also the Console Output tab, to check for errors.

16. Add a table node, from the output palette, then hit Run and…..VOILA!!!

Final Comments and Conclusions.

R nodes, in SPSS Modeler, offer a great opportunity for R lovers to combine the graphical interface SPSS offers and the variety algorithms available in R. Additionally, it is possible to combine them with data imputation routines, as well as feature selection capabilities (in case that model specification is required), to speed up the modeling process. Multiple algorithms can be used in the same stream to compare results

For questions please contact me or your Mainline account executive.

Mainline