Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am trying to compile the sample of ARIMAProcess of MMA here .It doesn't work.What is wrong?Could you please help?I am using exact same code.

data = TemporalData[FinancialData["EUR/USD", {{2012, 5, 1}, {2012, 9, 30}}]]["Part",All, {{2012, 5, 1}, {2012, 9, 30}}];
DateListPlot[data["Path"], Joined -> True, Filling -> Bottom, ImageSize -> 350]
eproc = EstimatedProcess[data, ARIMAProcess[40, 2, 0]]
forecast = TimeSeriesForecast[eproc, data, {20}]
DateListPlot[{data["Path"], forecast["Path"]}, Joined -> True, 
Filling -> Axis, PlotLabel -> "EUR/USD", ImageSize -> 350]
share|improve this question
    
Post the code you are using here? –  Öskå Jun 17 '13 at 14:23
    
@Öskå I add it ok? –  Alex Jun 17 '13 at 14:29
    
What version of Mathematica are you using? –  Öskå Jun 17 '13 at 14:31
    
@Öskå version 9.0.1 –  Alex Jun 17 '13 at 14:37
2  
I think the problem is the FinancialData call. It uses Yahoo Finance and I have noted in the past the results can be flaky (depending on the weather, or whatever. Apparently, today is one of those days). Sometimes it just returns no data. If you retry your code a couple of times you will see it will give you the figure. I just did and I got the intended figure. By the way: don't use the word 'compile' in your question. It does not describe what you did. –  Sjoerd C. de Vries Jun 17 '13 at 14:37
show 13 more comments

1 Answer

up vote 8 down vote accepted

There are a couple of known bugs at play here. First, in TemporalData the date increment is given as a rational number but some of the underlying date functionality doesn't know how to handle this (e.g. DateList doesn't reliably cannonicalize date lists with fractional components).

(*As of 9.0.1*)
data = TemporalData[FinancialData["EUR/USD", {{2012, 5, 1}, {2012, 9, 30}}]]["Part",
         All, {{2012, 5, 1}, {2012, 9, 30}}];

data["UnexpandedRawTimes"]

(*{TemporalData`DateSpecification[{2012, 5, 1, 0, 0, 0.}, {2012, 9, 30, 0, 0, 0.}, 
    {149/104, "Day"}]} *)

The more critical issue is that TemporalData functionality changed for version 9.0.1 to allow for these date specifications so that a wider array of time specifications could be treated as uniformly spaced. Unfortunately, TimeSeriesForecast wasn't updated to reflect the change.

This will all be fixed in future versions but for now the only work around is to work with numeric time stamps rather than dates as @Stefan suggested.

data = TemporalData[
   Select[FinancialData["EUR/USD", {{2012, 5, 1}, {2012, 9, 30}}], 
     FreeQ[#, Missing] &][[All, 2]]];

eproc = EstimatedProcess[data, ARIMAProcess[40, 2, 0]];

forecast = TimeSeriesForecast[eproc, data, {20}];

ListPlot[{data["Path"], forecast["Path"]}, Joined -> True, 
 Filling -> Axis, PlotLabel -> "EUR/USD", ImageSize -> 350]

enter image description here

share|improve this answer
    
and i thought that my workaround isn't valuable enough. thank you @Andy. i think it is perfect that you posted the answer, since you know exactly where the final problem lies (TimeSeriesForecast). i didn't. it just did the job... –  Stefan Jun 17 '13 at 17:23
    
@Andy many thanks for the answer.I dont know why these days I am just confronting MMA bugs.@Sjoerd C. de Vries could you please tell us how can you get result??!! Isn't it strange? –  Alex Jun 17 '13 at 17:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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