There's more...

Even though prophet is a very robust package, don't expect it to find extraordinary patterns in the data. Here, we are loading the beer prices for Argentina from 1994 to 2005, but will cut the data off at 2001 and will estimate our model, assuming we hadn't seen what happened after December 2001. Prophet's results look reasonable, with a variance (forecast band) that grows as we go farther into the future. The problem here, is that Argentina had a huge crisis in December 2001, which caused major economic and political upheavals. This generated a massive depreciation in its currency, which jumped around 200% over the following years. This caused the inflation rate to increase dramatically, and all prices, including beer's, more than tripled:

beer_prices = read.csv("beer_prices.csv") 
beer_prices$indice_tiempo = as.Date(beer_prices$indice_tiempo,"%Y-%m-%d")
colnames(beer_prices) = c("ds","y")
beer_prices1 = beer_prices[1:106,]
model <- prophet::prophet(beer_prices1)
future <- prophet::make_future_dataframe(model,periods=48,freq="month",include_history = TRUE)
preds <- predict(model,future)
plot(model,preds)

The following output shows Prophet's forecast:

In fact, if we do tail(preds)[,c(1,16)], we get that the predictions are actually 133 for Q3-2005, when the actual values (obtained by doing tail(beer_prices)) were around 850. In fact, the actual values can be plotted via plot(ts(beer_prices$y, frequency=12, start=c(1993,1))). As we can see, there is no possible way to predict what happened after 2001 if we only have data up to 2001. 

The following output shows the more complicated caseā€”Full series after 2001. It's not possible to predict what happened after 2001:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.28.80