Forecasting using Prophet in R

Loading the Packages

library(prophet)
library(tidyverse)

Loading the Dataset

bitcoin <- read.csv("/Users/andrea/Documents/Semester 2/04. Seminar/BitcoinPrice.csv")
head(bitcoin)
##           ds       y
## 1 2015-06-13 232.402
## 2 2015-06-14 233.543
## 3 2015-06-15 236.823
## 4 2015-06-16 250.895
## 5 2015-06-17 249.284
## 6 2015-06-18 249.007

Calling the Prophet Function to Fit the Model

Model1 <- prophet(bitcoin, daily.seasonality=TRUE)

Future1 <- make_future_dataframe(Model1, periods = 365)
tail(Future1)
##              ds
## 2185 2021-06-05
## 2186 2021-06-06
## 2187 2021-06-07
## 2188 2021-06-08
## 2189 2021-06-09
## 2190 2021-06-10
Forecast1 <- predict(Model1, Future1)
tail(Forecast1[c('ds','yhat','yhat_lower','yhat_upper')])
##              ds     yhat yhat_lower yhat_upper
## 2185 2021-06-05 8619.212  -282.1789   17151.62
## 2186 2021-06-06 8610.734  -376.8657   16684.34
## 2187 2021-06-07 8639.559  -154.1680   17344.36
## 2188 2021-06-08 8646.584  -163.9541   17191.73
## 2189 2021-06-09 8666.371  -364.6008   17335.43
## 2190 2021-06-10 8672.306  -172.8073   17196.33

Plotting the Model Estimates

dyplot.prophet(Model1, Forecast1)
## Warning: `select_()` is deprecated as of dplyr 0.7.0.
## Please use `select()` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_warnings()` to see where this warning was generated.
prophet_plot_components(Model1, Forecast1)