Yahoo Finance Stock Forecast

Coursera Data Products Project

Onur Akpolat

Introduction

This application is using the BATS forecasting model to forecast the stock price 3 days in future.

Stock price is a typical Time Series data. BATS model is exploiting the complex seasonal patterns in the data with exponential smoothing and performing the forecast.

Live Applicaton

The live application is available here:

Forecast

Data Source

This application is using R's quantmod package. Users will select on of the predefined stock symbols and the data range as source for the forecast. The application will automatically download the closing price information from Yahoo finance and provide a chart for visualization.

As with any data prediction, we should have a good data source that could show us some patterns for the prediction. User can observe in the chart if there are any seasonal patterns for the forecast.

plot of chunk quantmod

Interactive Plot with NVD3.js

NVD3 has a very interactive line chart with view finder. You can find selective legend, mouse-over focus to show data points at top chart and the view finder for time range at the bottom. It is making the application much more appealing.

BATS model (forecast)

BATS is an exponential smoothing state space model with Box-Cox transformation, ARMA errors, Trend and Seasonal components. We can use this to forecast 3 days in horizon and with 95% confidence level for prediction levels.

fit <- bats(data.df$ClosingPrice, use.parallel=FALSE)
fcast <- forecast(fit, h=3, level=95)