knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-images/", message = FALSE ) Sys.setlocale("LC_TIME", "C")
Extension for Facebook Prophet.
You can install prophetExt from github with:
# install.packages("devtools") devtools::install_github("hoxo-m/prophetExt")
or
# install.packages("githubinstall") githubinstall::githubinstall("prophetExt")
Ready data.
df <- read.csv("https://raw.githubusercontent.com/facebook/prophet/master/examples/example_wp_peyton_manning.csv") df$y <- log(df$y)
Fit model.
library(prophet) m <- prophet(df, daily.seasonality = FALSE)
Pick changepoints.
library(prophetExt) cpts <- prophet_pick_changepoints(m) head(cpts)
Draw changepoints.
future <- make_future_dataframe(m, 365) fore <- predict(m, future) plot(m, fore) + autolayer(cpts)
Detect outliers.
outliers <- prophet_detect_outliers(m)
head(outliers)
Draw outliers.
plot(m, fore) + autolayer(outliers)
Draw outliers using calendar plot.
prophet_calendar_plot(outliers)
shf <- prophet_shf(m, periods = 365)
head(shf$estimated)
plot(shf)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.