Written by Peter Rosenmai on 12 Dec 2015.
SPSS Modeler streams can be executed from R via input files and command-line calls. It's a hacky technique, but it works. And it's an easy way to make use of Modeler's excellent Expert Modeler functionality.
First, create an example of the data file that you want Modeler to read in. For example, if you want to run Modeler on a single time series, your data file will probably be a text file comprising a date column and a value column.
Then create and save a Modeler stream that reads in that file, fits the required model and produces an output file. This is fairly easy so I won't cover it here. But this is how it might look:
Next, you need to write R code to:
Here's an example running on Windows:
The system() function runs synchronously by default, but it may be run asynchronously. In that case, you'll want to periodically check the timestamp on the output file to see whether the call to Modeler has finished.
And if your call to Modeler doesn't work, try looking in the log file specified by the -log option in the system call.