From the website: “This dataset contains several daily features of S&P 500, NASDAQ Composite, Dow Jones Industrial Average, RUSSELL 2000, and NYSE Composite from 2010 to 2017.”
Libraries and data:
library(fpp2)
## Warning: package 'fpp2' was built under R version 3.6.2
## Registered S3 method overwritten by 'xts':
## method from
## as.zoo.xts zoo
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
## ── Attaching packages ──────────────────────────────────────────────────────────────────────────── fpp2 2.4 ──
## ✓ ggplot2 3.3.2 ✓ fma 2.4
## ✓ forecast 8.13 ✓ expsmooth 2.3
## Warning: package 'ggplot2' was built under R version 3.6.2
## Warning: package 'forecast' was built under R version 3.6.2
##
library(knitr)
cnn=read.csv("/Users/nelsonwhite/Documents/ms applied economics/Predictive Analytics:Forecasting/week 2 discussion/Processed_NYSE.csv")
cnn=ts(cnn[,2], start=c(2010,01,01),frequency=12)
autoplot(cnn, xlab = "Time", ylab="NYSE Close")
What is up with my date variable? Silly mistake?
cnn.additive <- decompose(cnn,type = "additive")
autoplot(cnn.additive)
checkresiduals(remainder(cnn.additive))
## Warning in modeldf.default(object): Could not find appropriate degrees of
## freedom for this model.
cnn.mutliplicative <- decompose(cnn,type = "multiplicative")
autoplot(cnn.mutliplicative)
checkresiduals(remainder(cnn.mutliplicative))
## Warning in modeldf.default(object): Could not find appropriate degrees of
## freedom for this model.