Now I have a tsm
, say tsm=TimeSeriesModelFit[data]
.
Now, while using TimeSeriesForecast
to forecast it, is there a way to let Mathematica only print the result in my desired range, say larger than 10 but smaller than 20.
1 Answer
$\begingroup$
$\endgroup$
2
Using some data
from the documentation of TimeSeriesModelFit
data = {5., 9., 8., 10., 6.1, 10.4, 9.1, 11.6, 7.5, 12.1, 10.4, 13.5, 9., 14.1, 11.9, 15.7,
10.8, 16.4, 13.7, 18.3, 12.9, 19., 15.8, 21.2, 15.3, 22.1, 18.3, 24.6};
tsm = TimeSeriesModelFit[data];
tsf = TimeSeriesForecast[tsm, {10, 20}];
ListLinePlot[{TimeSeries[data], tsf}]
tsf["Path"]
{{37, 36.7126}, {38, 31.2892}, {39, 41.3135}, {40, 33.7416}, {41, 44.8659}, {42, 39.0431}, {43, 50.7289}, {44, 42.9233}, {45, 55.6801}, {46, 49.5727}, {47, 63.1753}}
Or
forecast = {#, tsm[#]} & /@ Range[37, 47]
{{37, 36.7126}, {38, 31.2892}, {39, 41.3135}, {40, 33.7416}, {41, 44.8659}, {42, 39.0431}, {43, 50.7289}, {44, 42.9233}, {45, 55.6801}, {46, 49.5727}, {47, 63.1753}}
ListLinePlot[{TimeSeries[data], forecast}]
-
$\begingroup$ sorry my question is that, the mathematica will only output the result in my desired range... not the number of steps forward... $\endgroup$ Dec 1, 2015 at 8:07
-