0
$\begingroup$

I'm trying to forecast the log-returns of Amazon's stocks using the ARIMA model, so I went through the traditional procedure of examining the autocorrelation plot and the partial autocorrelation plot to determine the appropriate values of the parameters $q$ and $p$. The plot of Amazon's historical stock prices is,

enter image description here

the plot of Amazon's log-returns is,

enter image description here

the plot of the autocorrelation and partial autocorrelation are,

enter image description here

enter image description here

after examining the two plots, assigning both parameters $p$ and $q$ a value of zero would be appropriate.

Now we present the forecasting plots of the ARIMA model when assigned (0, 0, 0) and (0, 1, 0) as parameters, we get the following graphs,

enter image description here

enter image description here

We can clearly see that ARIMA(0, 1, 0) fits the data way better than ARIMA(0, 0, 0). If log returns are assumed to follow a white noise process shouldn't ARIMA(0, 0, 0) fit the actual data the best? the prediction of ARIMA(0, 0, 0) (from t =250 onward) seems accurate but its fitting of the data apparently isn't? can anyone clarify...

The code of the first forecast:

from statsmodels.tsa.arima_model import ARIMA

model = ARIMA(LogReturns[1:], order=(0, 0, 0))

model_fit = model.fit()

model_fit.plot_predict(1, 280, dynamic=False)
plt.xlabel(r'$t$')
plt.ylabel(r'$P_t$')
plt.title('Logarithmic Returns Prediction Using the ARIMA(0, 0, 0)')
plt.show()

The code of the second forecast:

from statsmodels.tsa.arima_model import ARIMA

from statsmodels.tsa.arima_model import ARIMA

model = ARIMA(LogReturns[1:], order=(0, 1, 0))

model_fit = model.fit()

model_fit.plot_predict(1, 280, dynamic=False)
plt.xlabel(r'$t$')
plt.ylabel(r'$P_t$')
plt.title('Logarithmic Returns Prediction Using the ARIMA(0, 1, 0)')
plt.show()
$\endgroup$
  • 2
    $\begingroup$ Regarding We can clearly see that ARIMA(0, 1, 0) fits the data way better than ARIMA(0, 0, 0), your eyes have tricked you. You should look at the vertical (instead of shortest) distance between forecasts and actual values. $\endgroup$ – Richard Hardy Aug 19 at 8:32
  • $\begingroup$ Adding to Richard's comment - the model fit plots are have different y-axis ranges. Comparison is hard. $\endgroup$ – yoav_aaa Aug 19 at 10:45
  • $\begingroup$ In general, economic theory says that it is unlikely to predict a generic stock price based on its past values. Keep it in mind when trying to predict tomorrow prices of a stock based on yesterday price. Indeed let’s consider the first difference of log prices, I.e log returns. It is common to model financial log returns assuming that the process of log returns is stationary with a conditional mean of 0. This is NOT a rule! However, it is a very common assumption in finance, because usually daily stock prices are considered random walks. $\endgroup$ – Fr1 Aug 19 at 10:49
  • $\begingroup$ See for example my answer here for more details on random walks stats.stackexchange.com/q/422755/253250 $\endgroup$ – Fr1 Aug 19 at 10:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.