Forecasting the stock market

In this recipe, we will develop a step-by-step 2-year forecast of the Fiat-Chrysler Automotive stock price.

This task will be accomplished by applying the Arima modeling technique to FCA stock time series.

Arima (Autoregressive integrated moving average) models basically involve the estimation of an autoregressive model and a moving average, employed to estimate both the stochastic part and the underlying trend.

Getting ready

This recipe is mainly based on the tseries package and forecast package, the first for Arima model fitting and the second for prediction of future values. We will also need the quantmod package in order to download stock data from Yahoo Finance.

We therefore need to install and load these three packages: ...

Get RStudio for R Statistical Computing Cookbook now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.