Chapter 27 Predictions using Prophet for Battery - Simple Assault

We predict the Crimes for the Battery - Simple Assault for the months of September to December 2017 using Prophet.

colnames(LACrimeGroupBatterySA) = c("ds","y")

m <- prophet(LACrimeGroupBatterySA,changepoint.prior.scale = 0.1)
## Initial log joint probability = -2.43405
## Optimization terminated normally: 
##   Convergence detected: relative gradient magnitude is below tolerance
future <- make_future_dataframe(m, periods = 4,freq = "month")

forecast <- predict(m, future)

predictionsValues = tail(forecast$yhat,4)

dataSetCrimes = data.frame(Month = as.character(), CrimeCount = as.numeric())

dataSetMonths = data.frame(c("September 2017",
                             "October 2017",
                             "November 2017",
                             "December 2017"))

dataSetCrimes = cbind(dataSetMonths,round(predictionsValues))

colnames(dataSetCrimes) = c("Months","Predictions")

kable(dataSetCrimes,"html") %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"))
Months Predictions
September 2017 1562
October 2017 1609
November 2017 1387
December 2017 1393