Soccer Opinion

Griffon Soccer is headed into the middle of the season with the odds in their favor. The team has an overall record of 7–3–2 and a conference record of 4–1. Missouri Western started off the season…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Using Time Series Analysis with ARIMA and GARCH Model in R To Analyze Stocks

After hearing about merger possibilities between Grub and Uber, I decided to do a brief stock analysis of Grub, to see how the stock has been doing and how it is going to perform in the next few months.

Figure 1. (GRUB) stock prices between April 2019 and May 2020

I started off by getting the chart for Grub’s stock price between April 2019 and May 18th 2020 — Figure 1.

As you can see from the chart, Grub experienced a major stock price drop of 43.295% to $38.97 on October 29th. This drop happened after Grub published its quarterly results.

To get a better understanding of the stock, I created a Bollinger Bands Chart, Volume Traded, and MACD (Moving Average Convergence Divergence).

In this chart below, it is clear that there is a strong downtrend, where the price starts to trade within a descending channel.

A break of the 15-period moving average, after witnessing bullish divergence further provides the signal to enter the trade.

Figure 2. Bollinger Bands, Volume Traded, and MACD

The MACD line has also crossed the signal line, proving that the MACD indicator supports the bullish trade. It can also be seen that the MACD line continues to move above the signal line, which translates to a strong upward momentum.

We’ll now begin to use the ARIMA method to forecast.

Because financial time series is usually exposed to exponential growth, which allows log transformation to linearize the series, I used differencing to stabilize the time series’ variance.

Figure 4. Difference Log Grub

Compared to price series, time series is more of an interest, because we tend to look at the return of the stocks rather than the prices. Differences in log prices are similar to percentage changes in stock prices.

Figure 5 below shows an auto-regressive model, AUTO-ARIMA, that will help us in forecasting close price values to the future.

As seen, there is a blue line in the chart, which represents the mean of the prediction.

Figure 5
Figure 6

In Figure 5 above, there are dark and light grey areas, which translate to 80% and 95% confidence intervals in lower and upper scenarios respectively.

Figure 8. Dataset forecast upper first few values

Using MACD and ARIMA alone to analyze is not enough. I decided to use GARCH model to use its function in making “volatility clustering”, which would help us minimize volatility effects.

I ran auto ARIMA function to find ARIMA parameters, which I later, incorporated into a Garch model.

Figure 9

Figure 10 below shows the Akaike and other information about the model. As we can see, we’ve reached better Akaike and Bayes test values for our model.

Figure 10

All the derived information is then used to create normal residuals plot — shown in Figure 11 below.

Below is the plot of the standardized residuals.

Figure 12

Although we have some outliers that are out of the normal distribution, the majority of the data lies in the centerline.

After having all the models required, I plot the data prediction, showing the forecast for the next 3 months — shown below.

Figure 13

As we can see, the model predicted a tendency of lower prices in the next 3 months. However, note that the auto-regressive model uses historical data to forecast future values. ARIMA model also does not take into account recent changes that might have taken place.

BOOK RECOMMENDATIONS

Add a comment

Related posts:

Top 3 Skills Successful Healthcare Leaders Possess

No matter where they are on the chain, or the leadership hierarchy, healthcare leaders all have huge responsibilities. Whether they are making administrative decisions or leading teams of doctors or…

19 lessons of 2020

Year 2020 was an interesting year for everyone and a bad year for many. Irrespective of the circumstances associated with the COVID-19 pandemic-lockdown-downturn-deaths, here are 19 nuggets I noted…

Eu tenho medo

Tenho medo da minha mente e das lembranças borradas que pairam sobre ela. “Eu tenho medo” is published by M.