** Predicting the Trend of Amazon Fire TV for 2017**
Method
I will use wikipedia trend and facebook prophet for this prediction:
library(wikipediatrend)
tail(data)
##
## 160 if (!found)
## 161 warning(gettextf("data set %s not found", sQuote(name)),
## 162 domain = NA)
## 163 }
## 164 invisible(names)
## 165 }
library(ggplot2)
summary(data)
## date count lang
## Min. :2014-01-01 Min. : 0.0 Length:749
## 1st Qu.:2014-07-07 1st Qu.: 317.0 Class :character
## Median :2015-01-10 Median : 395.0 Mode :character
## Mean :2015-01-10 Mean : 420.6
## 3rd Qu.:2015-07-16 3rd Qu.: 509.0
## Max. :2016-01-20 Max. :9454.0
## page rank month title
## Length:749 Min. :-1 Length:749 Length:749
## Class :character 1st Qu.:-1 Class :character Class :character
## Mode :character Median :-1 Mode :character Mode :character
## Mean :-1
## 3rd Qu.:-1
## Max. :-1
The 0.00 value for the minimum means that data might not have been available. I will go ahead and remove it, replacing it with NA
data$count[data$count==0]<-NA
Also, I am going to assign “ds” to the date variable, “y” to the count variable and create a data frame that contains two columns with the above information.
ds<-data$date
y<-data$count
df<-data.frame(ds,y)
qplot(ds,y, data = data)
## Warning: Removed 93 rows containing missing values (geom_point).
Now, I am going to specify the data frame I want to use, create a future data frame and use that to make the prediction of the trend of Amazon Fire TV for 2017.
library(prophet)
## Loading required package: Rcpp
m<-prophet(df)
## Warning in set_auto_seasonalities(m): Disabling yearly seasonality. Run
## prophet with `yearly.seasonality=TRUE` to override this.
## Initial log joint probability = -2.75475
## Optimization terminated normally:
## Convergence detected: relative gradient magnitude is below tolerance
future<-make_future_dataframe(m, periods = 365)
tail(future)
## ds
## 1109 2017-01-14
## 1110 2017-01-15
## 1111 2017-01-16
## 1112 2017-01-17
## 1113 2017-01-18
## 1114 2017-01-19
As, you can see from the datestamp above, now we have date for 2017.Let’s make the prediction for the count trend for Amazon Fire TV for 2017.
forecast<-predict(m,future)
plot(m, forecast)
Conclusion The popularity of Amazon Fire TV for 2017 will increase particularly on Fridays.
Let’s me show you in clearity of what I mean by the above using the graphs below:
prophet_plot_components(m, forecast)