Removing multiplicative seasonality and trend from observations using Prophet?

Viewed 641

I've fitted Prophet with logistic growth and multiplicative seasonality over time series data (daily observations spanning several years, no additional regressors; just ds, y) and have the forecast dataframe. How do I use the values from forecast to remove seasonality?

Within forecast, I acknowledge the weekly and yearly columns deal with seasonality on a weekly/yearly basis, and multiplicative_terms deals with changing magnitudes over time; but I don't know how to put this together to remove seasonality form my data.

I have the following possibly ways about attempting to remove seasonality, but believe what I'm doing is wrong.

#R
df$y - forecast$trend * forecast$multiplicative_terms * forecast$weekly * forecast$yearly

For reference, when using seasonal_decompose, I've had to use the following to get rid of seasonality; this doesn't hold for Prophet because of the additional terms.

#Python
df.y  - trend* decomposition.seasonal

Edit- After doing a bit of research, I'm currently running this which looks right, but I was wondering if anyone can confirm whether this is the correct way to remove seasonality + trend?

df$y - 
   (forecast$trend + 
   (forecast$trend * forecast$weekly) + 
   (forecast$trend * forecast$yearly) + 
   (forecast$trend * forecast$multiplicative_terms)
)
0 Answers
Related