-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.Rmd
More file actions
73 lines (53 loc) · 1.36 KB
/
Copy pathREADME.Rmd
File metadata and controls
73 lines (53 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
dpi = 192,
fig.width = 6,
fig.height = 4,
out.width = 600,
message = FALSE
)
Sys.setlocale("LC_TIME", "C")
```
# prophetExt: Additional Features for Prophet Time-Series Forecasting
<!-- badges: start -->
<!-- badges: end -->
## Installation
You can install the development version of prophetExt like so:
``` r
remotes::install_github("hoxo-m/prophetExt")
```
## Example
This is a basic example which shows you how to solve a common problem:
```{r example}
df <- read.csv("https://raw.githubusercontent.com/facebook/prophet/master/examples/example_wp_log_R_outliers2.csv", skip = 337, col.names = c("ds", "y"))
head(df)
```
```{r}
library(prophet)
model <- prophet(df)
df_future <- make_future_dataframe(model, 365)
fore <- predict(model, df_future)
plot(model, fore)
```
```{r}
library(prophetExt)
outliers <- detect_outliers(model)
plot(model, fore) + autolayer(outliers)
```
```{r, fig.width=10, fig.height=7.5, out.width=1000}
plot_residuals_calendar(outliers)
```
```{r}
df$y[df$ds %in% outliers$ds] <- NA
model <- prophet(df)
df_future <- make_future_dataframe(model, 365)
fore <- predict(model, df_future)
plot(model, fore)
```