2
$\begingroup$

Here is my function ploting the temporal data and the forecast of a given time series:

Function[{dates, trees, keys, diff},
  Manipulate[Module[{ts, tsm},
    ts = TimeSeries[Transpose@{dates, trees[key]}];
    tsm = TimeSeriesModelFit[ts, "SARMA"];
    DateListPlot[{tsm["TemporalData"], TimeSeriesForecast[tsm, {90}]},
     PlotLabel -> tsm,
     PlotLegends -> {"TemporalData", "Forecast"},
     ImageSize -> imageSize]]
   , {key, keys}]
  ];

I want to show the 50% and 95% confidence interval as bands on the forecasting part, is there a way to modify my function to show it?

trees is just the name of my dataset.

$\endgroup$
8
$\begingroup$

There is a lot in documentation, e.g.

enter image description here

For illustration:

This is times series of AUD US exchange rate 1990 to 2016.

tsm = TimeSeriesModelFit[aus, "ARIMA"];
forecast = TimeSeriesForecast[tsm, {0, 5}]
q[ci_] := Quantile[NormalDistribution[], 1 - (1 - ci)/2]
se = Sqrt[forecast["MeanSquaredErrors"]];
tsci[ci_, u_] := TimeSeriesThread[{1, u q[ci]}.# &, {forecast, se}];
Manipulate[
 DateListPlot[{aus, forecast, tsci[ci, 1], tsci[ci, -1]}, 
  Filling -> {3 -> {4}}, 
  PlotStyle -> {Black, Red, {Red, Dashed}, {Red, Dashed}}],
 {ci, {0.9, 0.95, 0.99}}]

enter image description here

$\endgroup$
0
$\begingroup$

Also in the documentation of TimeSeriesModelFit - see the examples in Applications section for use of TimeSeriesModel with property of "PredictionLimits".

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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