ARIMA
ARIMA stands for autoregressive integrated moving average models. Generally, it is defined by the equation ARIMA(p, d, q).
Here,
p is the order of the autoregressive model
d is the order required for making the series stationary
q is the order of moving average
The very first step in ARIMA is to plot the series, as we need a stationary series for forecasting.
So let us first plot the graph of the series by executing the following code:
> PriceData<-ts(StockData$Adj.Close, frequency = 5) > plot(PriceData)
This generates the following plot:
Figure 4.9: Plot of price data
Clearly, upon inspection, the series seems to be nonstationary, so we need to make it stationary by differencing. This can be done by executing the following code:
> PriceDiff <- diff(PriceData, differences=1) > plot(PriceDiff)
This generates the following plot for the differenced series:
Figure 4.10: Plot of differenced price data
This is a stationary series, as the means and variance seem to be constant...