Skip to content

itssiumbel/Nonstationary-time-series

Repository files navigation

Project 1

In accordance with the objective of this project, which consists in highlighting the trend from nonstationary time series, I performed the following tasks:

  1. Collected a data representing a deliberately nonstationary time series and then considered various types of trends: a) linear, b) exponential, c) logarithmic, e) quadratic, e) power. Using the least squares method,I found the coefficients of the equations, substituted them into the trend equations. And then it became possible to highlight the trends from the data and obtain the residuals. Below presented plots of the linear and quadratic trend equations.

The plot of the linear trend equation. The plot of the quadratic trend equation.


  1. Here was the step where I analysed the residuals and checked them for stationarity by obtaining autocorrelation matrix and its eigen values. It was found that the nonstationary series after the trend highlighting becomes stationary, which can be considered as success. Next I obtained a model for further fitting of the residuals. In addition, autocorrelation and partial autocorrelation functions were constructed, according to their behavior I made an assumption that the model would be MA(2) and AR(1).

The plot of the autocorrelation function. The plot of the partial autocorrelation function.


  1. On this step I tested an alternative method of obtaining residuals. The issue in order to find out whether it is possible to identify a trend in a time series without resorting to a method that includes certain equations with specially selected coefficients. As the plot of the autocorrelation function shows us, this method is successful and suitable for use.

The plot of the alternative autocorrelation function.


  1. I fitted tha data with various models (AR(p), MA(q), ARMA(pq)). And after obtaining a new time series – the final fit, it was compared with the original data by mean square error, which shows the level of the quality of the data approximation, and, therefore, the quality of the fit.

  2. Based on the results of the comparative analysis, it was concluded that the best model for fitting the data is MA(1), which, however, contradicts the assumption about the model, which was made on the behavior of the autocorrelation function and the partial autocorrelation function. In addition, it was concluded that the residuals obtained from some types of trends (linear and logarithmic) fit better of the rest, which means that these trends are preferable in use in practice.