# Is Prophet from Facebook any different from a linear regression?

So what I've read about Facebook's prophet is that it basically breaks down the time series into trend and seasonality. For example, an additive model would be written as:

$$y(t) = g(t) + s(t) + h(t) + e_t$$

with

• $$t$$ the time
• $$g(t)$$ the trend (may it be linear or logistic)
• $$s(t)$$ the seasonality (daily,weekly,yearly...)
• $$h(t)$$ the holidays
• $$e_t$$ the error

My questions are: Couldn't it be done with a simple linear regression? What would be the differences in term of results if we compared them, and why?

• Yes you could do this with a linear model. I don't know Prophet but if this is all that it is doing then there is no difference. – user2974951 Jul 12 at 12:42

The issue here is to get to an equation that parses the observed data to signal and noise. If your data is simple then your regression approach might work. Care should be taken to understand some of the assumptions that they are making with Prophet. You should better understand what Prophet does do, as it doesn't just fit a simple model but attempts to add some structure.

For example, some reflections that I made after reading their well-written introduction might help you in your evaluation. I apologize in advance if I have misunderstood their approach, and would like to be corrected if so.

1) Their lead example has two break-points in trend but they only captured the most obvious one.

2) They ignore any and all ARIMA structure reflecting omitted stochastic series or the value of using historical values of Y to guide the forecast.

3) They ignore any possible dynamics ( lead and lag effects ) of user-suggested stochastic and deterministic series. Prophet's causal regression effects are simply just contemporaneous.

4) No attempt is made to identify step/level shifts in the series or seasonal pulses e.g. a change in the MONDAY EFFECT halfway through time due to some unknown external event. Prophet assumes "simple linear growth' rather than validating it by examining alternative possibilities. For a possible example of this see Forecasting recurring orders for an online subscription business using Facebook Prophet and R

5) Sines and Cosines are an opaque way of dealing with seasonality, while seasonal effects such as day-of-the-week, day-of-the-month, week-of-the-month, month of-the-year are much more effective/informative when dealing with anthropogenic ( dealing with humans ! ) effects.

Suggesting frequencies of 365.25 for yearly patterns makes little sense because we don't perform the same action on the exact same day as we did last year, while monthly activity is much more persistent, but Prophet doesn't appear to offer the 11 monthly indicators option. Weekly frequencies of 52 make little sense because we don't have 52 weeks in each and every year.

6) No attempt is made to validate error processes being Gaussian so meaningful tests of significance can be made.

7) No concern for model error variance to be homogeneous, i.e., not changing deterministically at particular points in time suggesting Weighted Least Squares. No concern for finding an optimal power transform to deal the error variance being proportional to the Expected Value When (and why) should you take the log of a distribution (of numbers)? .

8) User has to pre-specify all possible lead and lag effects around events/holidays. For example, daily sales often start to increase in late November, reflecting a long-term effect of Christmas.

9) No concern that the resulting errors are free of structure suggesting ways to improve the model via diagnostic checking for sufficiency.

10) Apparently no concern with improving the model by deleting non-significant structure.

11) There is no facility to obtain a family of simulated forecasts where confidence limits may not necessarily be symmetrical via bootstrapping the model's errors with the allowance of possible anomalies.

12) Letting the user make assumptions about trends ( # of trend breakpoints and the actual breakpoints ) allows unwanted/unusable flexibility in the face of large-scale analysis which by it's name is designed for hands-free large-scale applications.

• Agree, but I'd say that those things are closer to "nice to have" features, then "must have". You can have high quality forecasting models lacking some of them. But, as I said, good points and nice review. – Tim Jul 16 at 21:17
• You are quite correct in your reflection...the inherent complexity of the "data" is the ruling issue. Simple data ..needs simple solutions .. complex data suggests that the " nice to have " might become become "need to have " . Only your data knows for sure ! Occam's razor comes to mind .. – IrishStat Jul 16 at 21:37
• @Tim stats.stackexchange.com/questions/417908/… thread suggests that some features that are "nice to have" should in reality be "must to have" to foil improper assumptions such as "simple linear trend" . – IrishStat Jul 18 at 12:45

I have not used it, but this is their preprint's abstract (emphasis mine):

Forecasting is a common data science task that helps organizations with capacity planning, goal setting, and anomaly detection. Despite its importance, there are serious challenges associated with producing reliable and high quality forecasts — especially when there are a variety of time series and analysts with expertise in time series modeling are relatively rare. To address these challenges, we describe a practical approach to forecasting “at scale” that combines configurable models with analyst-in-the-loop performance analysis. We propose a modular regression model with interpretable parameters that can be intuitively adjusted by analysts with domain knowledge about the time series. We describe performance analyses to compare and evaluate forecasting procedures, and automatically flag forecasts for manual review and adjustment. Tools that help analysts to use their expertise most effectively enable reliable, practical forecasting of business time series.

In the introduction:

We have observed two main themes in the practice of creating business forecasts. First, completely automatic forecasting techniques can be hard to tune and are often too inflexible to incorporate useful assumptions or heuristics. Second, the analysts responsible for data science tasks throughout an organization typically have deep domain expertise about the specific products or services that they support, but often do not have training in time series forecasting.

So it seems to me that they are not claiming to have made a substantial statistical advance here (although it is capable of far more than the simple model you outline). Instead, they claim that their system makes it feasible for large numbers of people without expertise in time series analysis to generate forecasts while applying their own domain expertise and system-specific constraints.

If you already have expertise in both time series analysis and in coding complex models, this may not be very helpful to you. But if their claims are true, this could be hugely useful! Science (and commerce) advances not just because of new ideas, but also because of new tools and their spread (see this short Freeman Dyson piece about the topic and this response).

To take an example from statistics itself: R did not represent a statistical advance, but it is has been massively influential because it made it easy for lots more people to do statistical analysis. It has been the scaffolding on which a great deal of statistical understanding has been built. If we are lucky, Prophet may play a similar role.

Dyson, Freeman J. "Is science mostly driven by ideas or by tools?." Science 338, no. 6113 (2012): 1426-1427.

You are missing the change points, piecewise linear splines, which can be implemented in linear models.

You are right that at least in the limiting case it's a linear regularised regression (L1 and L2 regularisation).

Note that there is a separate prophet model, logistic growth.

Also you are assuming the seasonal factors are additive, but they also support multiplicative seasonal effects, which seems more natural at least for growth modelling.

• The prophet assumption of taking logs flies in the face of this valuable discussion ... stats.stackexchange.com/questions/18844/… where power transforms are justified based upon an empirical relationship between the Expected Value and the model error variance OR a specific non-linear presumption base upon domain knowledge. – IrishStat Jul 14 at 12:56
• @IrishStat Thank you for that point (I had forgottten they log transform to implement multiplicative seasonality, they use STAN, so I believe they could have used a nonlinear model instead of taking logs). Can you explain your distinction between assumption of multiplicative seasonality and 'nonlinear presumption..' – seanv507 Jul 15 at 11:08
• If you look at @whuber's answer stats.stackexchange.com/questions/298/… he suggests transforms "when scientific theory indicates" which would be a possible non-linear assumption based upon domain knowledge. Empirical Power transforms are useful when the variance of the errors is found to be proportional to the expected value otherwise it might be simply "window dressing". – IrishStat Jul 15 at 11:55

A lot can be done with a simple linear regression but not all that Prophet does. Just one example, you can specify your own change point candidate for a trend, and Prophet will use it as a prior.