# Adjusting time-series before a sudden increase(the reason & time of the increase are known)

There are 2 increases in magnitude (one between feb and march, and one at the beginning of september)

(the chart has daily resolution btw)

Assuming weekly seasonality, is it ok to get the exact day when the increase was noticed and the day 1 week earlier, compute a scaling factor new/old and scale everything before the increase happened with that scaling factor ?

How is this operation usually called ? How do people usually do this, is it just this sort of scaling or is there a more correct(and perhaps more sophisticated) approach for this ?

What would you use for adjusting this time-series in either R or Python and statsmodels ? Is there a worked out example of this somewhere that I could read or could you describe one here ?

(The two increases have a common cause. The chart shows counts of certain posts on a website. At the times of the two increases, there was a new roll-out of a collector and as a result, more data started coming in. So the scaling I'm trying to do is trying to estimate how the time-series would have looked prior to the increases if the current collection were in place from the beginning, from January 2015)

• In statsmodels you can just add a indicator variable (0 before, 1 after the change date) as explanatory variable exog to ARMA, SARIMAX and similar models. Adding an additional linear trend could be appropriate to avoid that the indicator variable also captures some trend effects. A not very clean example of adding explanatory variables (using splines for seasonal effects) is at gist.github.com/josef-pkt/1ea164439b239b228557 The ARMAX version implemented in statsmodels is a linear model with ARMA errors. – Josef Sep 30 '15 at 16:39
• (Out of sample prediction in ARMA with explanatory variables requires statsmodels master or the yet unreleased 0.7 version because it fixes a timing bug.) – Josef Sep 30 '15 at 16:41