
2.1 Model PropertiesA discrete time series consists of a set of observations {x_{1}, x_{2}, ... , x_{t}, ... } of some phenomenon, taken at equally spaced time intervals. (We assume that x_{t} is real.) The main purpose of time series analysis is to understand the underlying mechanism that generates the observed data and, in turn, to forecast future values. We assume that the generating mechanism is probabilistic and that the observed series {x_{1}, x_{2}, ... , x_{t}, ... } is a realization of a stochastic process {X_{1}, X_{2}, ... , X_{t}, ... }. Typically, the process is assumed to be stationary and described by a class of linear models called autoregressive moving average (ARMA) models.
An ARMA model of orders p and q (ARMA(p, q)) is defined by where {_{i}} and {_{i}} are the coefficients of the autoregressive (AR) and moving average (MA) parts, respectively, and {Z_{t}} is white noise with mean zero and variance ^{2}. (We assume Z_{t} is normally distributed.) Using the backward shift operator B defined by B^{j}X_{t}=X_{tj}, the ARMA( p, q) model above can be written as where (B)=1_{1}B_{2}B^{2}... _{p}B^{p} and (B)=1+_{1}B+_{2}B^{2}+... +_{q}B^{q}. We assume that the polynomials (x) and (x) have no common zeros. When X_{t} is a vector, we have a multivariate or vector ARMA model; in this case, the AR and MA coefficients are matrices and the noise covariance is also a matrix denoted by . When all the zeros of the polynomial (x) (or its determinant in the multivariate case) are outside the unit circle, the model is said to be stationary and the ARMA( p, q) model can be expanded formally as an MA( ) model ( X_{t}=_{i}Z_{ti}). Similarly, if the zeros of (x) are all outside the unit circle, the ARMA( p, q) model is said to be invertible and can be expanded as an AR( ) model.
Autoregressive integrated moving average (ARIMA) models are used to model a special class of nonstationary series. An ARIMA(p, d, q) (d nonnegative integer) model is defined by Seasonal models are used to incorporate cyclic components in models. A class of commonly encountered seasonal models is that of seasonal ARIMA (SARIMA) models. A SARIMA( p, d, q)( P, D, Q) _{s} model ( d and D are nonnegative integers and s is the period) is defined by where (x) and (x) are polynomials that describe the seasonal part of the process.
The commonly used time series models are represented in this package by objects of the generic form model[param_{1}, param_{2},...]. Each of these objects serves to specify a particular model and does not itself evaluate to anything. They can be entered as arguments of time series functions as well as generated as output. ARModel[philist, ^{2}]  AR( p) model with p AR coefficients in philist and normally distributed noise with variance ^{2}  MAModel[thetalist, ^{2}]  MA( q) model with q MA coefficients in thetalist and normally distributed noise with variance ^{2}  ARMAModel[philist, thetalist, ^{2}]  ARMA( p, q) model with p AR and q MA coefficients in philist and thetalist, respectively, and normally distributed noise with variance ^{2}  ARIMAModel[d, philist, thetalist, ^{2}]  ARIMA( p, d, q) model with p AR and q MA coefficients in philist and thetalist, respectively, and normally distributed noise with variance ^{2}  SARIMAModel[{d, D}, s, philist, Philist, thetalist, Thetalist, ^{2}]  SARIMA( p, d, q)(P, D, Q) _{s} model with p regular and P seasonal AR coefficients in philist and Philist and q regular and Q seasonal MA coefficients in thetalist and Thetalist, respectively, and normally distributed noise with variance ^{2} 
Time series models. Here, when model is used as a Mathematica function argument it means the model object defined above. The notation philist denotes a list of AR coefficients {_{1}, _{2}, ... , _{p}}, thetalist specifies a list of MA coefficients {_{1}, _{2}, ... , _{q}}, and so on. The noise is zeromean Gaussian white noise, and its variance or covariance matrix will be called the noise parameter. d (or D) is the order of differencing, and s is the seasonal period. To extract any of these arguments from a model, we can use the function Part or one of the following functions. ARCoefficients[model]  extract the AR coefficients of model  MACoefficients[model]  extract the MA coefficients of model  SeasonalARCoefficients[model]  extract the seasonal AR coefficients of model  SeasonalMACoefficients[model]  extract the seasonal MA coefficients of model  SeasonalPeriod[model]  extract the seasonal period of model  DifferencingOrder[model]  extract the differencing order of model  NoiseParameter[model]  extract the noise parameter of model 
Functions extracting the parameters of time series models. All of the functions in this package with the exception of AsymptoticCovariance and the functions analyzing ARCH models work for both univariate and multivariate cases, although some are illustrated using examples of univariate series only. Out[2]=  
Out[3]=  
Out[4]=  
Out[5]=  
Out[6]=  
ToARModel[model, n]  give the AR( n) model that is the order n truncation of the AR( ) expansion of model  ToMAModel[model, n]  give the MA( n) model that is the order n truncation of the MA( ) expansion of model  ToARMAModel[model]  convert an ARIMA or a SARIMA model to an ARMA model 
Conversions of time series models. Out[7]=  
Out[8]=  
Out[9]=  
Out[10]=  
Out[11]=  
Given a model, its covariance function and correlation function can be calculated. For a univariate zeromean, stationary process, the covariance function at lag h is defined by (h)=E(X_{t+h}X_{t}) ( E denotes the expectation); the correlation function, by (h)=(h)/(0). For a multivariate process, the matrix covariance function is defined by ( X^{} denotes the transpose of X), and the matrix correlation function at lag h, R(h), is given by where _{ij}(h)=((h))_{ij}. Another useful function is the partial correlation function. The partial correlation function at lag k, _{k, k}, is defined to be the correlation between X_{t+k} and X_{t} with all intervening variables fixed. The power spectrum of a univariate ARMA( p, q) process is given by , and for a multivariate process the power spectrum is . StationaryQ[model]  give True if model is stationary, False otherwise  StationaryQ[philist]  give True if the model with its AR coefficients in philist is stationary, False otherwise  InvertibleQ[model]  give True if model is invertible, False otherwise  InvertibleQ[thetalist]  give True if the model with its MA coefficients in thetalist is invertible, False otherwise  CovarianceFunction[model, n]  give the covariance function of model up to lag n  CorrelationFunction[model, n]  give the correlation function of model up to lag n  PartialCorrelationFunction[model, n]  give the partial correlation function of model up to lag n  Spectrum[model, ]  give the power spectrum of model as a function of 
Properties of time series models. Out[12]=  
Out[13]=  
Out[14]=  
Out[15]=  
Out[16]=  
Out[17]=  
Out[18]=  
Out[19]=  
Out[20]=  
Out[21]=  
RandomSequence[, ^{2}, n]  generate a random sequence of length n distributed normally with mean and variance ^{2}  TimeSeries[model, n]  generate a time series of length n from model  TimeSeries[model, n, {x_{p+1}, x_{p+2}, ..., x_{0}} ]  generate a time series with p given initial values  TimeSeries[model, n, {z_{q+1}, z_{q+2}, ..., z_{n}}, {x_{p+1}, x_{p+2}, ..., x_{0}} ]  generate a time series with a given noise sequence {z} and initial values {x} 
Generating random sequences and time series. Both RandomSequence and TimeSeries uses the current default random number generator. Sequences generated prior to Version 6.0 of Mathematica can be obtained by including the option LegacySequence→True. Out[22]=  
Out[23]=  
Out[24]=  
Out[25]=  
Out[26]=  
Out[27]=  
