Time Series Forecasting: Applications and Artificial Neural Networks

Time Series Forecasting: Applications and Artificial Neural Networks

Micha FISHER

In this article, Micha FISHER (University of Mannheim, MSc. Management, 2021-2023) discusses on the applications of time series forecasting and the use of artificial neural networks for this purpose.

This article will offer a short introduction to the different applications of time-series forecasting and forecasting in general, will then describe the theoretical aspects of simple artificial neural networks and finish with a practical example on how to implement a forecast based on these networks.

Overview

The American economist and diplomat John Kenneth Galbraith once said: “The function of economic forecasting is to make astrology look respectable”. Certainly, the failure of mainstream economics to predict several financial crises is testimony to this quote.

However, on a smaller scale, forecast can be very useful in different applications and this article describes several use cases for the forecasting of time series data and a special method to perform such analyses.

Different Applications of Time Series Forecasting

Different methods of forecasting are used in various settings. Central banks and economic research institutes use complex forecasting methods with a vast amount of input factors to forecast GDP growth and other macroeconomic figures. Technical analysts forecast the evolution of asset prices based on historical patterns to make trading gains. Businesses forecast the demand for their products by including seasonal trends (e.g., utility providers) and economic developments.

This article will deal with the latter two applications of forecasting that is focused on the analysis of historical patterns and seasonality. Using different input factors to come up with a prediction, like for example a multivariate regression analysis does, can be a successful way of making prediction. However, it also inherently includes the problem of determining those input factors as well in the first place.

The practical methods described in this article circumvent this problem by exclusively using historical time series data (e.g., past sales per month, historical electricity demand per hour of the day, etc.). This makes the use of those methods easy and both methods can be used to predict helpful input parameters of DCF models for example.

Artificial neural networks

Artificial Intelligence (AI) is a frequently used buzzword in the advertising of products and services. However, the concept of artificial intelligence is going back to the 1940s, when mathematicians McCulloch and Pitts first presented a mathematical model that was based on the neural activity of the human brain.

Before delving into the practical aspects of an exemplary simple artificial neural network, it is important to understand the terminology. These networks are one – although not the only one – of the key aspects of “Machine Learning”. Machine Learning itself is in turn a subtopic of Artificial Intelligence, which itself employs different tools besides Machine Learning.

Figure 1. Neural network.
Neural network
Source: internet.

To give a simple example of an artificial neural network we will focus on a so-called feedforward neural network. Those networks deliver and transform information from the left side to the right side of the schematic picture below without using any loops. This process is called Forward Propagation. Historic time series data is simply put into the first layer of neurons. The actual transformation of the data is done by the individual neurons of the network. Some neurons simply put different weights on the input parameter. Neurons of the hidden layers then use several non-linear functions to manipulate the data given to them by the initial layer. Eventually the manipulated data is consolidated in the output layer.

This sounds all very random and indeed it is. At the beginning, a neural network is totally unaware of its actual best solution and the first computations are done via random weights and functions. But after a first result is compiled, the algorithm compares the result with the actual true value. Of course, this is not possible for values that lye in the future. Therefore, the algorithm divides the historic time series into a section used for training (data that is put into the network) and into a section for testing (data that can be compared to the transformed training data). The deviation between compiled value and true value is then minimized via the process of so-called backpropagation. Weights and functions are changed iteratively until an optimal solution is reached and the network it sufficiently trained. This optimal solution then servers to compute the “real” future values.

This description is a very theoretical presentation of such an artificial neural network and the question arises, how to handle such complex algorithms. Therefore, the last part of this article focuses on the implementation of such a forecasting tool. One very useful tool for statistical forecasting via artificial neural networks is the programming language R and the well-known development environment RStudio. RStudio enables the user to directly download user-created packages, to import historical data from Excel sheets and to export graphical presentations of forecasts.

A very easy first approach is the nnetar function of R. This function can be simply used to analyze existing time series data and it will automatically define an artificial neural network (number of layers, neurons etc.) and train it. Eventually it also allows to use the trained model to forecast future data points.

The chart below is a result of this function used on simulated sales data between 2015 and 2021 to forecast the sales of 2022. In this case the nnetar function used one layer of hidden neurons and correctly recognized a 12-month seasonality in the data.

Figure 2. Simulated sales data.
Simulated sales data
Source: internet.

Why should I be interested in this post?

Artificial neural networks are a powerful tool to forecast time-series data. By using development environments like RStudio, even users without a sophisticated background in data science can make apply those networks to forecast data they might need for other purposes like DCF models, logistical planning, or internal financial modelling.

Useful resources

RStudio Official Website

Rob Hyndman and George Athanasopoulos Forecasting: Principles and Practice

Related posts on the SimTrade blog

   ▶ All posts about financial techniques

   ▶ Jayati WALIA Logistic regression

   ▶ Daksh GARG Use of AI in investment banking

About the author

The article was written in October 2022 by Micha FISHER (University of Mannheim, MSc. Management, 2021-2023).

This entry was posted in Contributors, Financial techniques and tagged , . Bookmark the permalink.