On the Autoregressive Time Series Model Using Real and Complex Analysis

The autoregressive model is a tool used in time series analysis to describe and model time series data. Its main structure is a linear equation using the previous values to compute the next time step; i.e., the short time relationship is the core component of the autoregressive model. Therefore, short-term effects can be modeled in an easy way, but the global structure of the model is not obvious. However, this global structure is a crucial aid in the model selection process in data analysis. If the global properties are not reflected in the data, a corresponding model is not compatible. This helpful knowledge avoids unsuccessful modeling attempts. This article analyzes the global structure of the autoregressive model through the derivation of a closed form. In detail, the closed form of an autoregressive model consists of the basis functions of a fundamental system of an ordinary differential equation with constant coefficients; i.e., it consists of a combination of polynomial factors with sinusoidal, cosinusoidal, and exponential functions. This new insight supports the model selection process.


Introduction
The increasing digitalization of all areas of society and the economy is leading to ever greater volumes of data. Many of these data are time series; i.e., they have a time component by which they can be ordered. When analyzing time series-with the aim of predicting future values or gaining knowledge about the underlying, generating processmathematical model building plays a crucial role.
In general, two types of models can be distinguished: domain-specific models on the one hand and general-purpose models on the other. As a rule of thumb, domain-specific models are preferable for corresponding (domain) problems. This rule corresponds to the principle of using existing knowledge, especially if this information is already reflected in the mathematical model. For example, when modeling radioactive decay [1] or the endemic development of a pandemic [2], a domain-specific model is a good starting point for data analysis. If this background knowledge about the domain and the use-case is not available or if this knowledge should not be used, general purpose models can be used for prediction. Many of these general purpose models exist and are explained in standard textbooks [3].
In mathematical modeling and model building, it is important that essential properties of a model are reflected in the data. If the data contradict the character of a model, the quality of the model-based prediction suffers; e.g., if the model has a linear relationship, although the data rather correspond to a parabola, a contradiction is given and the model is at most to be used with caution or is to be rejected. However, this decision assumes that all essential characteristics of a model are known and are not a black box. It is in this context that this article should be seen: the following sections describe the autoregressive model for time series. The characteristics of the model are usually interpreted using stochastic model building; this article shows a novel, different, analytical approach through the derivation of a closed form and thus reveals additional important model properties. In detail, the closed form of an autoregressive model consists of a combination of polynomial factors with sinusoidal, cosinusoidal, and exponential functions. This new insight supports the model selection process.

Related Work: The Autoregressive Model
Definition 1. A time series is a sequence of pairs (x i , y i ) that consist of a time component x i and an arbitrary component y i . To allow for the possibly unpredictable nature of future observations, it is natural to suppose that each observation is a realized value of a certain random variable [4]. The time component can be continuous x i ∈ R or discrete x i ∈ Z. If the context describes the timing implicitly-e.g., by a regular sampling in fixed intervals-the time component may be omitted.
The distinction between discreteness and continuity can be approached in various ways. JOHN L. BELL explains "To be continuous is to constitute an unbroken or uninterrupted whole, like the ocean or the sky. A continuous entity-a continuum-has no 'gaps'. Opposed to continuity is discreteness: to be discrete is to be separated, like the scattered pebbles on a beach or the leaves on a tree. Continuity connotes unity; discreteness, plurality" [5]. In addition to mathematical definitions and philosophical considerations [6], applied mathematics adds a pragmatic perspective: in many cases, organizational, practical, or technical conditions determine whether a variable can be considered discrete or continuous. This article does not make a strict distinction between continuous and discrete, but uses both interpretations in parallel.
In order to capture and analyze a time series mathematically, a mathematical model is required. A time series model for the observed data is a specification of the joint distributions of a sequence of random variables [4]. This article refers exclusively to the autoregressive (AR) model. According to JUDY L. KLEIN, the AR-model originated in the 1920s and was first applied by UDNY YULE in his 1927 analysis of the time-series behavior of sunspots [7]. Definition 2. The autoregressive model AR(p) determines the value of a process at an arbitrary time step t using a linear combination of the p-last values: The number p is called the order of the AR model.The weights φ i of the linear combination are the model parameters. They are considered to be constant. Furthermore, an AR model assumes that this process is superimposed by white noise; i.e. the ε t are assumed to be uncorrelated with each other in time and identically distributed, with an expected value of zero and finite variance. This model is abbreviated as AR(p).
Many definitions additionally require that the process described by AR(p) is stationary. This results in further conditions on the coefficients φ i , which are not a focus of the following considerations of this article.
raises several questions. Two of these questions concern the global structure of the model:

1.
Is the AR(p) model in principle able to describe characteristic properties of the time series (2); in other words, is the AR(p) model in principle suitable? 2.
If it is suitable, how is the parameter p selected?
Stating these questions in other words, what is the closed form of the model?
The model and its parameters are usually determined using a stochastic/statistical perspective [8,9]: the commonly used approaches are based on maximizing a likelihood function and obtaining the model parameters via the solution of the so-called modified Yule-Walker equations [10] or via ordinary least squares regression [11].
This article does not provide a new approach to select an appropriate model or to determine the model parameters; this article concentrates on the question of the closed form of the model. The goal is to derive an expression that can be used to evaluate any time step t without having to evaluate all previous values first. This approach to the AR model explicitly names the elementary building blocks of the model. These elementary building blocks should be reflected in the data-an insight that contributes to model selection and that gives decision support during the model building process. The only existing approach to the global structure of the autoregressive model has been presented by DIHUI LAI and BINGFENG LU: in "Understanding Autoregressive Model for Time Series as a Deterministic Dynamic System" [12], they interpret a first-order difference equation as an autoregressive model y t = φ 0 + φ 1 y t−1 . The assumed change over time in this formula is one unit. In general, the time step can be of any unit, and by changing the unit of time, it can be replaced with ∆t, and the equation can be rewritten as In the limit case ∆t → 0, the difference equation becomes a first-order time-dependent ordinary differential equation (ODE):

Global Structure
This article extends the state-of-the-art using eigenanalysis and ordinary differential equations in order to reveal important global properties of the AR(p) model, which should be reflected in the time series data and which provide decision support when selecting the model to describe a time series.

Eigenanalysis
The AR(p) model can be interpreted as a linear operator applied to an initial vector consisting of the data of the time series. The equation of the definition (1) is formulated in this interpretation as a matrix equation with a matrix containing the model parameters φ 1 , . . . , φ p . The forecast of the next k values is then simply the k-fold application of the linear operator A p : This equation can be transformed into a closed form for model orders p = 1, . . . , 4 via Jordan normal form [13]. For this purpose, the roots of the characteristic polynomial of the matrix A p and the corresponding eigenvectors have to be determined. For the characteristic polynomial, the following applies: is the base case of an induction. The induction step starts with and the determinant of this matrix will be computed by using the Laplace expansion along its last column.
The Laplace expansion reduces the p × p matrix (A p − λI) into two matrices. The determinate of the first matrix is one, since its structure contains a lower triangular matrix of zeros, and the product of the diagonal is one. The second matrix meets the induction hypothesis. As a consequence, due to the characteristic polynomial of A p is χ p (λ).
Having calculated the eigenvectors and the eigenspaces, the matrix A p can be decomposed into A p = T −1 D T with an orthogonal basis T. The matrix D is a diagonal matrix, if and only if the sum of the dimensions of its eigenspaces is equal to p. Otherwise, it is almost diagonal; i.e., with only non-zero elements on its diagonal and ones on its superdiagonal. Consequently, the k-fold application of the linear operator A p is where D k is usually easy to determine, meaning that Equation (7) can be evaluated to a closed form representation.
illustrates the previously presented approach. Written as linear operator, the AR(2)-model can be represented by the matrix Hence, the characteristic polynomial is Its roots are λ 1/2 = 1 2 (1 ± √ 5). Using the corresponding eigenvectors, the matrix A 2 can be decomposed into As a result, the closed form of this AR(2)-model is respectively, which is equivalent to the well-known, closed formula to calculate the Fibonacci sequence. This approach to derive a closed form equation can be used for model orders p = 1, . . . , 4, but for higher-order models (p > 4), the roots of the characteristic polynomial of the matrix A p and the corresponding eigenvectors cannot be determined in general, although special cases may have an exact, analytic solution.

Differential Equations
A novel approach is based on the idea of DIHUI LAI and BINGFENG LU, summarized in Section 2: they interpret a first-order difference equation as an autoregressive model y t = φ 0 + φ 1 y t−1 . This idea is now extended towards higher order AR(p) models. The basic idea of interpreting a difference equation as an AR model is symmetric; not only can the difference equation be interpreted as an AR model, but also vice versa. Furthermore, differential equations of higher degree correspond to AR models of higher order.
Besides the difference quotients in the following forms, namely forward difference and central difference ∆y to approximate the first-order derivative, there are also difference quotients for the numerical calculation of higher derivatives. The recursive definition of higher-order central difference quotients is for even degrees of n, and for odd degrees of n. In the limit analysis for ∆t → 0, the general AR(p) model becomes an ODE of order n = p; i.e., Equation (1) becomes a n y (n) + a n−1 y (n−1) + . . . + a 2 y + a 1 y + a 0 y = f (x) with constants a i , respectively, in normalized representation with a n = 1: y (n) + a n−1 y (n−1) + . . . + a 2 y + a 1 y + a 0 y = f (x).
The solution of this equation can be calculated with the help of the characteristic polynomial of the ODE [14], which is obtained by substituting the k-th derivative by λ k : χ(λ) = λ n + a n−1 λ (n−1) + . . . + a 2 λ 2 + a 1 λ + a 0 .
According to the fundamental theorem of algebra, a polynomial of degree n has exactly n roots, counting multiplicity. If all coefficients a i are real, the roots are real or occur in conjugate pairs. Each root corresponds to an independent solution, which together form the fundamental system that represents all solutions of the homogeneous ODE (with f (x) = 0). The necessary n linearly independent solutions can then be found using the rules to solve higher-order differential equations with constant coefficients: If r is a real root that appears k times, then the solutions are y = e r·t , y = t · e r·t , y = t 2 · e r·t , . . . , y = t k−1 · e r·t .
These building blocks of the fundamental system of the ODE are the components that compose the AR(p)-Model.
To illustrate these building blocks, the following synthetic example transforms an autoregressive model into a closed form representation. This is not the classical procedure in time series analysis. Time series analysis is usually a data-driven, inverse process; i.e., the time series are based on the assumption that there is a generating, stochastic process that is to be determined inversely from the data. In the following, synthetic example, we start from an exactly specified model, determine the time series realization from it, and determine the closed form. The last transformation step is in particular focus here-it shall clarify the connection between the representation according to Definition 2 (see Equation (1)) and the fundamental system in order to provide a more profound, theoretical insight. For practical applications, this approach is not recommended. Example: An exemplary AR model shall consist of the initial values y 0 = 1, y −1 = 2, y −2 = 0, and an order p = 3 linear combination with the coefficients 2, − 3 / 2 , and − 1 / 2 ; i.e., So-called white noise ε i is not used in this example. For practical applications, this assumption is very problematic and should not be used; however, in this synthetic theoretical example, this assumption is used to illustrate the similarity of the two AR model representations: without white noise, numerical inaccuracies are the only deviations that may occur between the two representations. As the AR(3)-model has an order of p = 3, the corresponding ODE has a characteristic polynomial of degree three. Such a polynomial may take the following forms:
One real root and a conjugate pair.
In the first case, the fundamental system would consist of three exponential functions with polynomial factors up to degree two. This basis would not be able to produce the generated data sequence of the time series-in particular, several sign changes contradict this model.
In the second case, the fundamental system consists of an exponential function and a pair of exponential functions multiplied with sine/cosine factors. These basis functions are reflected in the data sequence: the trigonometric functions are responsible for the sign changes. As a consequence, this case applies; i.e., the characteristic polynomial has one real and two conjugate complex zeros. The starting point for the fundamental system is therefore y = a 0 e a 1 ·x leads to an overdetermined, nonlinear system of equations, which can be solved with a numerical minimization procedure [15]. This optimization determines the fundamental system and simultaneously solves the initial value problem of the ODE: Using these constants in Equation (38) leads to a global description of the discrete model. In detail, the AR model with the initial values y 0 = 1, y −1 = 2, y −2 = 0 can be represented by the closed form y(x) = −2.015059E−12 e −13.601814·x + 2.5104196 e 0.35838324·x sin(11.896794 · x) (41) + 1.0790480 e 0.35838324·x cos(11.896794 · x).
The differences between both representations-the AR model and the ODE solution-if evaluated at discrete time stamps, are listed in Table 1. Small differences are shown, which were to be expected in the range of numerical inaccuracies of floating point arithmetic.
The approach of interpreting an arbitrary AR(p) model as a differential equation is new and allows the identification of the global structure: the building blocks of the fundamental system of the corresponding ordinary differential equation are the components of which the AR(p) model consists. The last example has illustrated this approach explicitly. Furthermore, the first example using the Fibonacci sequence (17) can be interpreted in this way and leads to an equivalent solution: Example: The Fibonacci sequence (17) has the closed form To outline its structure, this formula can be rewritten in terms of exponential functions This representation shows that the Fibonacci sequence is essentially composed of two exponential functions that dominate the trend of the corresponding time series. This is consistent with the global structure resulting from the fundamental system of the ODE as derived in this article: an AR(2) model leads to a differential equation of degree two; the corresponding characteristic polynomial of the ODE therefore also has degree two and thus has either two real roots (counting multiplicity) or two conjugate complex roots. The second case can be excluded, since this case would lead to trigonometric factors and thus to sign changes in the data series. The first case with two real zeros, on the other hand, leads exactly to the two exponential functions, which overlap as in Equation (43). Table 1. The example AR model has lead to an ordinary differential equation whose solution is a fundamental system (38) with an initial value problem. The solution to the initial value problem (39) describes the AR model globally; i.e., the AR model consists of oscillating exponential terms. The small differences ∆ between both representations are listed in the last column.

Application
In order to illustrate the application of the gained knowledge about the global structure, an example data set is used: the data set is the level of the river Mur measured by the Graz station, Austria (DBMS #6001082), as provided by the web-service https://ehyd.gv.at (accessed on 15 May 2020). The data set consists of one measurement of the water level per day starting on 1 January 1976 and running until 31 December 2016. A visual overview is shown in Figure 1. The diagram shows the annual data. Each year is plotted using a semi-transparent, blue-filled area plot on top of each other. Additionally, the diagram contains, for each day of a year, the minimum (white), average (light blue), and maximum (dark blue) water levels of all years (1976-2016) on the corresponding day. These values are visualized in line plots.
In this example, the goal is to forecast the water levels of the next three days on the basis of the previous 50 days; i.e., starting with January 1st, 1976, a sliding window of 50 days is used to determine an autoregressive model of order three (AR(3)) in order to forecast the water level of the next three days. In detail, the test consists of 14,974 time series of 50 values each with the challenge to predict the next three values. As the historic data are complete, the quality of the forecast can be evaluated using the ground truth.
This test is performed with two algorithmic approaches. The first approach determines the parameters of the AR(3) model via ordinary least squares regression as described by M. HAUSER, [11]. The second approach uses the explicit, closed form representation (see Equation (38)) and calculates the model parameters via conjugate gradient search [16].
The first approach, representing the established methods, performs well and achieves a prediction quality within the range of 0.07-0.15 m. The details are listed in Table 2 (left).
The second approach offers additional knowledge about the global structure. Unfortunately, this knowledge does not offer advanced possibilities to determine the model parameters. Although both model descriptions are equal, the non-linear optimization via conjugate gradient search to determine the model parameters introduces additional errors into the forecast, which are reflected in a reduced quality of the prediction (in the range of 0.16-0.27 m; see Table 2). Moreover, the computational cost of the second approach is higher due to the nonlinear optimization; even if, for the sliding window of size 50, the optimization result of the previous window is used as the starting value of the iterative optimization. Consequently, in most cases, the established approaches-e.g., using ordinary least squares-should be preferred, but the closed-form expression, which has to be determined using nonlinear optimization, has a very important advantage: the parameters of a closedform expression can be determined for any set of function parameters and function values, even if the function parameters are sampled irregularly. In such a case, the necessary adjustments to determine the AR model parameters via ordinary least squares are rarely found in existing implementations, while libraries for nonlinear parameter fitting usually do not impose any requirements on the sampling of the evaluation points with respect to regularity or irregularity. In other words, the practical relevance of this theoretical approach currently arises only when the data are irregular and "data gaps have to be bridged". a semi-transparent, blue-filled area plot on top of each other. Additionally, the diagram contains, for each day of a year, the minimum (white), average (light blue), and maximum (dark blue) water levels of all years (1976-2016) on the corresponding day. These values are visualized in line plots.  In this example, the goal is to forecast the water levels of the next three days on the basis of the previous 50 days; i.e., starting with January 1st, 1976, a sliding window of 50 days is used to determine an autoregressive model of order three (AR(3)) in order to forecast the water level of the next three days. In detail, the test consists of 14,974 time series of 50 values each with the challenge to predict the next three values. As the historic data are complete, the quality of the forecast can be evaluated using the ground truth.
This test is performed with two algorithmic approaches. The first approach determines the parameters of the AR(3) model via ordinary least squares regression as described by M. HAUSER, [11]. The second approach uses the explicit, closed form representation (see Equation 38) and calculates the model parameters via conjugate gradient search [16].
The first approach, representing the established methods, performs well and achieves a prediction quality within the range of 0.07-0.15 m. The details are listed in Table 2 (left).

Conclusions
The selection of a suitable model is a critical task in data analysis. Any decision support to narrow down the multitude of existing data models can avoid mistakes and save time in data analysis. The knowledge about the basic structure of a model is such a kind of decision support; e.g., a data series with a parabolic graph is not compatible with a data model consisting of a cubic polynomial, as the global properties of cubic polynomials are known and therefore exclude the incompatible data model at an early stage.
For the autoregressive model, this article has derived the global structure: an AR(p) model is composed of the fundamental system of a higher-order ordinary differential equation (ODE) with constant coefficients. The order of both models, AR(p) and ODE, are the same. As a consequence, if a data series does not correspond to a linear combination of sinusoidal, cosinusoidal, and exponential functions, the AR(p) model is unsuitable for the global description of the time series (but a temporally local modeling of the data may be possible). In detail, any AR(p) model is composed of the basis functions y = e r·t , y = t · e r·t , y = t 2 · e r·t , . . . , y = t k−1 · e r·t , if its characteristic polynomial has real roots only, and it consists of e α·t cos(β · t), e α·t sin(β · t), t · e α·t cos(β · t), t · e α·t sin(β · t), t 2 · e α·t cos(β · t), t 2 · e α·t sin(β · t), t k−1 · e α·t cos(β · t), t k−1 · e α·t sin(β · t), if it has complex roots. Furthermore, the derived closed form of an AR(p) model allows users to switch between different interpretations-namely, between a discrete and a continuous domain. Having a closed solution of a higher-order ordinary differential equation offers the possibility to evaluate the time series model at non-integer time steps, which is not possible using the discrete definition only.
This knowledge of the global properties of the AR(p) model represents the essential contribution of this article.
Funding: This work is funded by the Climate and Energy Fund and is being carried out as part of the "Smart Cities Demo-Boosting Urban Innovation 2020" program. Furthermore, the author acknowledges the generous support of the Carinthian Government and the City of Klagenfurt within the innovation center KI4Life.