0

I've developed a model like so:

fit <- data %>%
      model(
          prophet = fable::prophet(Value ~
                              xreg(a, b, c, d, e)
                              )
      ) 

The xregs are all binary intervention variables (except for "a" which is literally just the number of days in the month, because explicitly telling the model that apparently improves performance).

I would like to quantify the impact of variable "c" - ideally I would like to show on a line chart what the curve would look like if this event hadn't occurred (quantify the attribution). My thinking was to take the beta coefficient of this variable and plot two lines, one with and without. Assuming that's a valid approach (?), to do so I planned on extracting the equation for the model and the coefficients, but I'm having some trouble here.

tidy(fit) works to pull the coefficients (base growth, trend offset, coefficients of each xreg), but report(fit) returns "A model specific report is not available for this model class." I interpret that to mean report() isn't implemented for Prophet. Can anybody provide some suggestions for how I can interpret the coefficients and quantify attribution of the variable I'm interested in?

I'm also brainstorming developing two separate models - with and without the variable - and comparing forecasts of each, but this feels a little dubious.

Cero
  • 25
  • 5
  • 1
    You should be able to quantify the impact of `c` from the coefficient found using `tidy()`. The prophet model is a GAM, and so interpretation of linear regressors are as you would for a GAM. – Mitchell O'Hara-Wild Jan 20 '23 at 23:43
  • Thank you for the response @Mitchell O'Hara-Wild ! You've helped me in the past with a Fable question and I very grateful your contributions to the R community. This was my line of thought but I think I'm missing some terms. This is the equation I'm expecting: `yhat = base_growth_coeff(x_1) + trend_offset(x_2) + a(x_3) + b(x_4) + c(x_5) + d(x_6) + e(x_7) + intercept`. For a given period, I know the values for x_3 through x_7. I'm not clear on what the values would be for x_1, x_2, and the intercept. Do you have any suggestions? – Cero Jan 23 '23 at 17:55
  • If you could provide a minimal reproducible example then I might be able to better explain the coefficients. Other than that, your best resource would be the prophet paper where they explain the growth component of the model: https://peerj.com/preprints/3190/ – Mitchell O'Hara-Wild Jan 25 '23 at 00:21

0 Answers0