I have been running TimeSeriesForecast[] over a large number of TimeSeriesModels, and finding that it freezes for some models for some datasets for reasons for reasons I can not figure out.

See the path I've put online at http://pastebin.com/L6Saif1q for one example.

  tsmARIMA = TimeSeriesModelFit[freezingPath, "ARIMA"]; (* works fine *)
  tsmARMA = TimeSeriesModelFit[freezingPath, "ARMA"] (* works fine *)

TimeSeriesForecast[tsmARIMA, 1] (* works fine *)

TimeSeriesForecast[tsmARMA, 1] (* freezes *)

What is going wrong here? What can I do to avoid or prevent such freezing?

[Addendum / partial solution from a day later -- passing the Path from the problematic TimeSeries solves the problem sometimes. Thus,

tsmARMA = TimeSeriesModelFit[freezingPath["Path"], "ARMA"];
TimeSeriesForecast[tsmARMA, 1] (* works fine *)

But there are other TimeSeries for which this approach does not help. Feels like there's a bug in Mathematica here.]

  • $\begingroup$ Which Mathematica version are you using? On what OS? I do not get any freezing with 10.4.1 on my MacBook Pro -- see this screenshot. $\endgroup$ Commented May 12, 2016 at 1:56
  • $\begingroup$ @AntonAntonov 10.4.1 on Windows 7. Frustrating, it's totally replicable on my machine (for ARMA only though, I've put thousands of TimeSeries through ARIMA without incident). Thanks for checking. $\endgroup$ Commented May 12, 2016 at 1:58
  • $\begingroup$ Does it freeze if you (1) work with the differences instead, (2) take, say, a 2/3 smaller signal sample, (3) subtract the mean curve? (etc...) $\endgroup$ Commented May 12, 2016 at 2:13
  • $\begingroup$ @AntonAntonov Observations this morning -- 1. If I pass the timeseries data as a TimeSeries to TimeSeriesModelFit, Mathematica freezes when I run TimeSeriesForecast. However, if I pass only the Path data from the TimeSeries, there is no problem. 2. Scaling the datapoints, subtracting the mean, etc, has no difference. Changing the endpoints sometimes does. $\endgroup$ Commented May 12, 2016 at 13:01
  • $\begingroup$ I guess using the paths only (instead of TimeSeries) is the way to go... $\endgroup$ Commented May 12, 2016 at 13:16

1 Answer 1


One idea is to use RLink` and some of R's time series libraries like 'ts' or 'zoo'. A very comprehensive overview is given here: "CRAN Task View: Time Series Analysis".

Using RLink`

It is a good idea to have access to R's libraries in your machine.

See Szabolcs Horvat's "Setting up RLink for Mathematica" .

Then follow examples, say, from here: Quick-R: Time Series.

Concrete code

The following code works and produces ARIMA and ARMA forecasts. The libraries have to be installed beforehand (or use install.packages instead of library.)



(* SetEnvironment[
  "/Library/Frameworks/R.framework/Resources/lib"] *)

InstallR["RHomeLocation" -> 
  "/Library/Frameworks/R.framework/Resources", "RVersion" -> 3]

RSet["freezingPath", N@freezingPath];

RSet["freezingPathVals", N@freezingPath[[All, 2]]];

RSet["freezingPathTimes", N@freezingPath[[All, 1]]];


(* {"zoo", "stats", "graphics", "grDevices", "utils", "datasets", \
"reshape2", "plyr", "methods", "base"} *)


(* {"forecast", "timeDate", "zoo", "stats", "graphics", "grDevices", "utils", "datasets", "reshape2", "plyr", "methods", "base"} *)



(* RObject[{3.296*10^9, 3.306*10^9, 3.316*10^9, 3.316*10^9, 3.325*10^9, 3.335*10^9}, 
  "names" :> {"Min.", "1st Qu.", "Median", "Mean", "3rd Qu.", "Max."},
   "class" :> {"summaryDefault", "table"}]] *)



REvaluate["fit<-HoltWinters(frPathTS,beta=FALSE, gamma=FALSE)"];

REvaluate["forecast(fit, 5)"]
  • $\begingroup$ Thanks. I got a simpler version of this working but I will study your example and improve my implementation. $\endgroup$ Commented May 12, 2016 at 20:46
  • $\begingroup$ @MichaelStern Great! $\endgroup$ Commented May 12, 2016 at 20:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.