Daniel RG

10/27/2020

Load packages and data. Royal Dutch Shell (RDS) closing prices. Data starts 10/29/2018 and ends 10/27/2020.

library(fpp2)
library(ggplot2)
library(ggthemes)

rds <- read.csv("rds.csv")
rds <- rds[order(rds$Date),]
rdsdata <- subset(rds, select = c(Date, Close))
rdsts=ts(rdsdata[,2],start=c(2018,10,29),end=c(2020,10,27),frequency=250)

plot1 <- autoplot(rdsts) + geom_line() +
  xlab("Year") + ylab("Price") + ggtitle("Royal Dutch Shell (RDS)") + theme_classic()

plot1

Forecasts

meanf <- meanf(rdsts, h=25)
naivef <- naive(rdsts, h=25)
driftf <- rwf(rdsts, drift = TRUE, h=25)
forecastf <- forecast(rdsts, h=25, lambda="auto", biasadj = TRUE)


fplot <- autoplot(rdsts) +  autolayer(meanf, series="Mean", PI = FALSE) + 
                            autolayer(naivef, series="Naive", PI = FALSE) + 
                            autolayer(driftf, series="Drift", PI = FALSE) +
                            autolayer(forecastf, series="Forecast", PI = FALSE) +
    xlab("Year") + ylab("Price") + ggtitle("RDS Stock Price Projection Models") + theme_classic()

fplot

Residuals

resdrift <- residuals(driftf)
plot(resdrift)
title(main = "Residuals of Drift Model")

resf <- residuals(forecastf)
plot(resf)
title(main = "Residuals of Forecast Model")     

The drift model looks like the best model.