Modeling outliers as special events
There is one final way to work with outliers in Prophet; it’s a technique we used with James Rodríguez’s data in Chapter 8, Influencing Trend Changepoints – we can declare the outliers as a special event, essentially a holiday. By putting the outliers into the holidays
DataFrame, we essentially instruct Prophet to apply trends and seasonality as if the data points were not outliers and capture the additional variation beyond trends and seasonality in the holiday term.
This can be useful if you know that the extreme observations are due to some external factor that you do not expect to repeat. Such external factors could be the World Cup or a large marketing campaign but may also be mysterious and unknown. You can keep the data in your model but essentially disregard it. An added benefit is that you can simulate what would happen if the event repeated.
We’ll again use the National Geographic data but, this time...