SEO traffic Forecast x
⚠️ THIS IS A WORK IN PROGRESS
For this one will be using a Forcast library done by Facebook called Prophet
1
path <- file.choose()
2
3
4
df <- read.csv(path, skip = 6)
5
6
View(df)
7
8
df <- data<-na.omit(df)
9
10
library(lubridate)
11
library(prophet)
12
13
origin_date <- ymd("2019-01-01")
14
15
origin_date + ddays(1)
16
17
df$index <- as.numeric(rownames(df))-1
18
19
df$ds <- origin_date+ddays(df$index-1)
20
21
df$ds <- df$Day.Index
22
23
df$y <- df$Sessions
24
25
df$Sessions <- NULL
26
df$Day.Index <- NULL
27
28
29
#ggplot(df)
30
31
m <- prophet(df)
32
33
34
future <- make_future_dataframe(m, periods = 365)
35
36
# R
37
forecast <- predict(m, future)
38
tail(forecast[c('ds', 'yhat', 'yhat_lower', 'yhat_upper')])
39
40
41
# View(forecast)
42
43
plot(m, forecast)
44
45
prophet_plot_components(m, forecast)
46
47
dyplot.prophet(m, forecast)
48
49
Copied!
Last modified 8mo ago
Copy link