WOLFRAM

TimeSeriesForecast[tproc,data,k]

gives the k-step-ahead forecast beyond data according to the time series process tproc.

gives the k-step-ahead forecast for TimeSeriesModel tsmod.

Details and Options

  • TimeSeriesForecast[tproc,{x0,,xm},k] will give Expectation[x[m+k]x[0]x0x[m]xm], where xtproc, the expected value of the process given data.
  • TimeSeriesForecast allows tproc to be a time series process such as ARProcess, ARMAProcess, SARIMAProcess, etc.
  • The data can be a list of numeric values {x1,x2,}, a list of time-value pairs {{t1,x1},{t2,x2},}, or TemporalData.
  • The following forecast specifications can be given:
  • kat the k^(th) step ahead
    {kmax}at 1, , kmax steps ahead
    {kmin,kmax}at kmin, , kmax steps ahead
    {{k1,k2,}}use explicit {k1,k2,} steps ahead
  • TimeSeriesForecast returns the forecasted value if k is an integer and TemporalData otherwise.
  • The default for k is 1.
  • TimeSeriesForecast supports a Method option with the following settings:
  • Automaticautomatically determine the method
    "AR"approximate with a large-order AR process
    "Covariance"exact covariance function-based
    "Kalman"use Kalman filter
  • The mean squared errors of the prediction are the compounded noise errors and are given as MetaInformation in the TemporalData output. For forecast=TimeSeriesForecast[tproc,data,k], the mean squared errors can be accessed by forecast["MeanSquaredErrors"].

Examples

open allclose all

Basic Examples  (3)Summary of the most common use cases

Forecast three steps ahead for an ARProcess:

Out[2]=2

An ARMAProcess:

Out[3]=3

Predict the seventh value from TimeSeriesModel:

Out[2]=2

Mean squared error of the forecast:

Out[3]=3

Forecast a vector-valued time series process:

Find the forecast for the next 10 steps:

Out[2]=2

Plot the data and the forecast for each component:

Out[3]=3

Scope  (7)Survey of the scope of standard use cases

Step  (4)

Forecast one step ahead:

Out[3]=3

Forecast the third step ahead:

Out[4]=4

Find forecast for all the steps ahead up to the fifth:

Out[2]=2

Show the path:

Out[3]=3

Forecast all the steps ahead in the range from third to fifth:

Out[2]=2

Show the path:

Out[3]=3

Forecast for a list of steps:

Out[2]=2

Path:

Out[3]=3

Mean Squared Errors  (3)

Forecast one step ahead:

Out[3]=3

Return the forecast as TemporalData to extract mean squared errors:

Out[4]=4
Out[5]=5
Out[6]=6

Find the forecast with mean squared errors:

Calculate the forecast:

Standard errors:

Define the error bands:

Plot the data and forecast with mean error bands:

Out[6]=6

Find the forecast with 95% confidence intervals:

Find the forecast for the next 10 steps:

Find mean squared errors and confidence intervals:

Plot data, forecast, and the forecast limits:

Out[6]=6

Options  (4)Common values & functionality for each option

Method  (4)

Find the forecast using the covariance-based method:

Out[3]=3
Out[4]=4

Find the forecast using the autoregressive method:

Out[1]=1
Out[2]=2

Find the forecast using the Kalman filter method:

Out[1]=1
Out[2]=2

Compare exact and approximate methods for an MAProcess:

Out[2]=2
Out[3]=3

Both methods agree for the autoregressive processes:

Out[5]=5
Out[6]=6

Applications  (3)Sample problems that can be solved with this function

The daily exchange rates of the euro to the dollar from May 2012 through September 2012:

Out[2]=2
Out[3]=3

Fit an AR process to the exchange rates:

Out[4]=4

Forecast for 20 business days ahead:

Out[5]=5

Plot the forecast with original data:

Out[6]=6

Consider hourly temperature readings for September 9, 2012, near your location:

Out[1]=1

The data contains missing values:

Out[2]=2

Redefine time series with MissingDataMethod to fill in missing data with interpolated values:

Out[3]=3

Check if the time stamps are regularly spaced:

Out[4]=4

Resample by an hour:

Out[5]=5
Out[6]=6

Estimate an ARProcess:

Out[7]=7

Calculate prediction for the next 12 hours:

Out[8]=8

Plot forecast with original data:

Out[9]=9

Retail monthly sales in United States:

Out[2]=2

Create TimeSeries from the selection:

Out[3]=3

Plot the sales with grid lines at December peaks:

Out[4]=4

Fit a seasonal model:

Out[5]=5

The process parameters:

Out[6]=6

Find forecast for the next 7 years:

Out[7]=7

Calculate 95% confidence bands for the forecast:

Out[8]=8

There is an upper and a lower band:

Out[9]=9

Plot the forecast within the 95% confidence region:

Out[11]=11

Properties & Relations  (3)Properties of the function, and connections to other functions

Forecasting with ARProcess using the exact or approximate method gives the same result:

Out[1]=1
Out[2]=2
Out[3]=3

Forecast is the same for a time series process and its invertible representation:

This process is not invertible:

Out[2]=2

Find its invertible representation:

Out[3]=3

Compare forecasts:

Out[5]=5
Out[6]=6
Out[7]=7
Out[8]=8

Use TimeSeriesModel to forecast:

Out[2]=2

Compute forecast for 20 steps:

Out[3]=3

Use process and data explicitly:

Out[4]=4

Compare paths:

Out[5]=5

Possible Issues  (2)Common pitfalls and unexpected behavior

"Kalman" method requires the parameters of the process to be numeric:

Out[1]=1

If the invertible representation does not exist, the forecast may not be reliable:

Out[1]=1
Out[2]=2
Wolfram Research (2012), TimeSeriesForecast, Wolfram Language function, https://reference.wolfram.com/language/ref/TimeSeriesForecast.html (updated 2014).
Wolfram Research (2012), TimeSeriesForecast, Wolfram Language function, https://reference.wolfram.com/language/ref/TimeSeriesForecast.html (updated 2014).

Text

Wolfram Research (2012), TimeSeriesForecast, Wolfram Language function, https://reference.wolfram.com/language/ref/TimeSeriesForecast.html (updated 2014).

Wolfram Research (2012), TimeSeriesForecast, Wolfram Language function, https://reference.wolfram.com/language/ref/TimeSeriesForecast.html (updated 2014).

CMS

Wolfram Language. 2012. "TimeSeriesForecast." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/TimeSeriesForecast.html.

Wolfram Language. 2012. "TimeSeriesForecast." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/TimeSeriesForecast.html.

APA

Wolfram Language. (2012). TimeSeriesForecast. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TimeSeriesForecast.html

Wolfram Language. (2012). TimeSeriesForecast. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TimeSeriesForecast.html

BibTeX

@misc{reference.wolfram_2025_timeseriesforecast, author="Wolfram Research", title="{TimeSeriesForecast}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/TimeSeriesForecast.html}", note=[Accessed: 11-May-2025 ]}

@misc{reference.wolfram_2025_timeseriesforecast, author="Wolfram Research", title="{TimeSeriesForecast}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/TimeSeriesForecast.html}", note=[Accessed: 11-May-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_timeseriesforecast, organization={Wolfram Research}, title={TimeSeriesForecast}, year={2014}, url={https://reference.wolfram.com/language/ref/TimeSeriesForecast.html}, note=[Accessed: 11-May-2025 ]}

@online{reference.wolfram_2025_timeseriesforecast, organization={Wolfram Research}, title={TimeSeriesForecast}, year={2014}, url={https://reference.wolfram.com/language/ref/TimeSeriesForecast.html}, note=[Accessed: 11-May-2025 ]}