Wolfram Language & System 11.0 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)


constructs a time series model for data from an automatically selected model family.

constructs a time series model for data from a model family specified by mspec.

Details and OptionsDetails and Options

  • TimeSeriesModelFit is used in time series analysis. It automates the selection of a time series model from a large class of possible models.
  • TimeSeriesModelFit returns a symbolic TimeSeriesModel object to represent the time series model it constructs. The properties and diagnostics of the model can be obtained from model[property].
  • A list of available model properties can be obtained using model["Properties"].
  • The data can be a list of numeric values {x1,x2,}, a list of time-value pairs {{t1,x1},{t2,x2},}, a TimeSeries, or TemporalData.
  • The value of the model at time t can be obtained by giving model[t]. If t is in the range of the input data, then the data at time t is returned; otherwise, a forecasted value is given.
  • Forecast prediction limits at a time t can be obtained using model["PredictionLimits"][t].
  • The model specification mspec can take the following forms:
  • Automaticautomatically select the model to use
    "family"select a model from a given family
    {"family",params}select a model from a subset within a given family
  • The following families and parameterizations can be used:
  • "AR"{p}autoregressive model family
    "MA"{q}moving-average model family
    "ARMA"{p,q}autoregressive moving-average model family
    "ARIMA"{p,d,q}integrated ARMA model family
    "SARMA"{{p,q},{sp,sq},s}seasonal ARMA model family
    "SARIMA"{{p,d,q},{sp,sd,sq},s}seasonal ARIMA model family
    "ARCH"{q}ARCH model family
    "GARCH"{q,p}GARCH model family
  • Autoregressive and moving-average orders p and q and their seasonal counterparts sp and sq can be given as Automatic, a non-negative integer, a list of non-negative integers, or a Span indicating such a list.
  • The non-seasonal and seasonal integration orders d and sd can be given as Automatic, a non-negative integer, a list of non-negative integers, or a Span indicating such a list.
  • For seasonal models, the seasonality parameter s can be Automatic or a positive integer.
  • Additional model family parameterizations are given in the examples.
  • The following model properties can be obtained using model["property"]:
  • "BestFit"the fitted model
    "BestFitParameters"coefficient estimates
    "ErrorVariance"model error variance
    "FitResiduals"residuals for the fitted model
    "StandardizedResiduals"standardized model residuals
    "TemporalData"input data as TemporalData
  • Properties pertaining to model selection include:
  • "CandidateModels"a set of candidate models sorted by selection criterion
    "CandidateModelSelectionValues"selection criterion values for each candidate model
    "CandidateSelectionTable"a table containing models and selection criterion values
    "CandidateSelectionTableEntries"entries from the candidate selection table
    "ModelFamily"the selected model family
    "SelectionCriterion"criterion used for selecting the best model
  • Properties that measure goodness of fit include:
  • "AIC"Akaike information criterion
    "AICc"finite sample corrected AIC
    "BIC"Bayesian information criterion
    "SBC"SchwartzBayes information criterion
  • The following properties can be used to assess the whiteness of the model residuals:
  • "ACFPlot"plot of residual autocorrelations
    "ACFValues"values from the "ACFPlot"
    "PACFPlot"plot of residual partial autocorrelations
    "PACFValues"values from the "PACFPlot"
    "LjungBoxPlot"plot of LjungBox residual autocorrelation test -values
    "LjungBoxValues"values from the "LjungBoxPlot"
  • The maximum number of lags to include for a residual whiteness property "wprop" can be controlled by giving model["wprop","LagMax"->max], where max is a positive integer.
  • Properties and diagnostics for coefficient estimates include:
  • "CovarianceMatrix"covariance estimate for model coefficients
    "InformationMatrix"information matrix for model coefficients
    "ParameterConfidenceIntervals"confidence intervals about the coefficient estimates
    "ParameterStandardErrors"standard errors of model coefficients
    "ParameterTable"table of fitted coefficient information
    "ParameterTableEntries"entries in the parameter table
  • TimeSeriesModelFit takes the following options:
  • ConfidenceLevel95/100confidence level to choose
    IncludeConstantBasisAutomaticwhether to include a constant in the model
    MethodAutomaticthe method to use for model selection
    WorkingPrecisionAutomaticprecision used in internal computations
  • The default setting IncludeConstantBasis->Automatic will include a constant in the model if both the non-seasonal and seasonal integration orders are zero; otherwise, no constant will be included.
  • The method m in Method->m can be either "Stepwise" or "GridSearch". For stepwise selection, Automatic parameter orders are incrementally changed until a model with an optimal selection criterion is found. Using a grid search exhaustively tries all models over a specified grid.
  • The best model is selected according to a selection criterion crit, which can be set in Method->{m,"SelectionCriterion"->crit}. Some examples of valid selection criteria include "AIC" (default), "AICc", "SBC", and "BIC".

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

Fit a time series model to some data:

Click for copyable input
Click for copyable input

The fitted time series model:

Click for copyable input

Obtain a point forecast and 95% prediction limits at time 35:

Click for copyable input
Click for copyable input

Visualize the data with a 10-step-ahead forecast:

Click for copyable input
Introduced in 2014