Close this search box.
Close this search box.

Is ARMA A Linear Model? Application and optimization of ARMA model in stock price prediction

Is ARMA A Linear Model? Application and optimization of ARMA model in stock price prediction

Math & Technology

Deep Learning God Yann LeCun
An ARMA model, or Autoregressive Moving Average model, used to describe weakly stationary stochastic time series in terms of two polynomials. The first of these polynomials is for autoregression, the second for the moving average.
An ARMA process consists of two models: an autoregressive (AR) model and a moving average (MA) model. Compared with the pure AR and MA models, ARMA models provide the most effective linear model of stationary time series since they are capable of modeling the unknown process with the minimum number of parameters.
Application and optimization of ARMA model in stock price prediction

Firstly, using AR, MA, and ARMA models to predict stock prices. It could become found that compared with the actual price, the results of these three models had a certain lag.  Then, predicting the trend using the ARMA model after removing the residuals from the seasonal decomposition to get the predicted price, it could be noticed that this model  seems to correctly predict stock price trends at some point although the result was still  not satisfactory. This indicated that there might be important information in the  residuals, which is the heteroscedasticity of the residuals. Means that the GARCH  model could become applied to the residuals. And it can become concluded that the model using  ARMA for the linear part and GARCH for the residual part. Moreover, could become used to predict the stock price.  


Firstly, AR, MA, and a combination of the two models (ARMA) were used to make  stock price predictions and the result of all three models had some lags compared to  real price (Fig 1-3), since each day’s predictions should be derived from the previous  day’s data, the lag made this model unusable for predictions.  

Fig 1. AR model prediction results  
Fig 2. MA model prediction results 
Fig 3. ARMA model prediction results  

 However, the steps of obtaining stationary data during the construction of the  ARMA model could give some inspiration. There are two ways to obtain stationary  data, one is difference and the other is seasonal decomposition. So, the residuals could become removed from the seasonal decomposition and predict the trend using the ARMA model,  then add the seasonal data to get the predicted price (Fig 4).  

Fig 4. Prediction results of ARMA model after seasonal decompose  

 Although the result is still not satisfactory, this model seems to predict the trend  of the stock price, the model successfully predicted the initial decline and intermediate  rise. But overall, this cannot be a good predictive model because it is too far from the  actual price. Nevertheless, this also could give some inspiration. Since the prediction  the model made after removing the residuals was still not ideal, did it mean that there  was some important information in the residuals?  

 So, after doing a correlation test on the residuals, it could be concluded that the  residuals were not relevant, but it could be found that the residuals had significant  heteroscedasticity when testing the ARCH effect on the residuals. Therefore, we used  ARMS for the linear part and GARCH for the residual part. 

The predicted results were shown in the following graph (Fig 5), and this model  only used the data before August 2017 to predict the data for the next 20 days, so it  could be used to predict the stock price. However, due to the random variables in the  GARCH model, sometimes the model may give some wrong predictions (Fig 6).  

Fig 5. Prediction results of the combination of ARMA and GARCH models  

Fig 6. Prediction results of the combination of ARMA and GARCH models  


The model used Goldman Sachs’ 2018 stock price data  


1. Doing differential or taking natural logarithm several times to get time series  data stationary. Generally, d is either 0, 1, or 2. After that it will fit an ARMA(p, q) process.

2. By comparing various choices of p and q by some criterion that measures how  well a model fits the data and how well it can be expected to predict future price from  the original data. In practice, AIC(Akaike’s information criterion) and SBC(Schwarz’s  Bayesian Criterion) are two common approaches. AIC was chosen for an 


Where L is the likelihood evaluated at the MLE. The better model according to  the criterion is the model that minimizes that criterion. AIC trades off some good fit to  the data by L but it’s a better one here.  

3.(Model checking) Using white noise testing to test for residual autocorrelation.  An introduction of The Ljung-Box test: It tests whether any of a group of  autocorrelations of a time series are different from zero. It tests the “overall”  randomness based on a number of lags, and is therefore a portmanteau test.  

Seasonal Decompose: 

Fig 7. Seasonal Decompose 

In conclusion, conclusions cannot become reached at this time because we need to predict more data to verify our conclusions. Furthermore, the combination of ARMA and GARCH could become speculated as a tool to predict stock prices. The predicted price using ARMA and GARCH has some reference value, but there is still a gap with reality.  

Lastly, in the research process. Moreover, GARCH became applied on the residuals to further extract the information in the residuals. And turned the irregular information in the residual into a random variable in GARCH. Furthermore, such irregular information becomes determined by the outside world. Such as investor mood, unemployment rate, GDP and other factors, Therefore, the ARMA-GARCH model can become a tool for analyzing the past. Lastly, lastly, through these random values, it may be possible to analyze which external factors are determining the stock price.

Is ARMA A Linear Model? Application and optimization of ARMA model in stock price prediction
Dr. Igor Halperin. On Reinforcement Learning. IRL For Investing & The Dangers of Deep Learning

Math & Technology