R Packages Utilized

library(readr)
library(ggplot2)
library(ggfortify)
library(forecast)

Importing the Monthly Adjusted Stock Prices of Target

## Target Stock (NYSE:TGT)
tgt <- read_csv("C:/Users/bryce_anderson/Desktop/Boston College/Predictive Analytics and Forecasting/Week 6 (PA&F)/TGT.csv")
## Source: https://finance.yahoo.com/quote/TGT/history?period1=1357016400&period2=1546232400&interval=1mo&filter=history&frequency=1mo

Plotting and Inspecting the Time Series

Target (NYSE:TGT)

## Target (NYSE:TGT)
tgtTS <- ts(tgt$close, frequency=12, start=c(2013,1)) ## Creating time series for close variable
autoplot(tgtTS) + xlab("Month") + ylab("Adjusted Monthly Close Price")

acf(tgtTS)

pacf(tgtTS)

checkresiduals(tgtTS)

Neural Net Model

nn <- nnetar(tgtTS, lambda = 0)
autoplot(nn) + ylab("Monthly Adjusted Close Price") + xlab("Month")

## Forecast 2 Years
autoplot(forecast(nn, h=24)) + ylab("Monthly Adjusted Close Price") + xlab("Month")

The model chose a NNAR(2,1,2) for the 24 month forecast.

Neural Net Model - Non-Bootstrap Example

nn2 <- nnetar(tgtTS, lambda = 0, bootstrap=FALSE)
autoplot(nn2) + ylab("Monthly Adjusted Close Price") + xlab("Month")

## Forecast 2 Years
autoplot(forecast(nn2, h=24)) + ylab("Monthly Adjusted Close Price") + xlab("Month")

The autoselection picked the same model but the forecasted values change slightly without the bootstrap method.