# Modelling slopes over time

I have data of the price of a product before a newer version came out and after a newer version came out. I'd like to model the slope of the product pre the new product, and post the new product.

Looking at the data, it is obvious when this point is and the negative slope over time for the product increases in magnitude.

Linear models did not make much sense, since intercepts are different and not realistic?

PRE:

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept)         668.12155    2.25824  295.86   <2e-16 ***
pre                  -0.23071    0.01968  -11.72   <2e-16 ***


POST (after day 150):

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept)           821.00351   10.96838   74.85   <2e-16 ***
post                   -1.13929    0.04899  -23.25   <2e-16 ***


Any advice on how to deal with this problem would be helpful.

-
Our (many) threads on change point analysis may provide some useful ideas. –  whuber Jan 31 at 19:34
@whuber Thank you for the definition! –  PascalvKooten Jan 31 at 19:35

Instead of running the models for your two periods separately $$y_1 = \alpha_1 + \beta_1 X_1 + u_1$$ $$y_2 = \alpha_2 + \beta_2 X_2 + u_2$$ you can combine them as $$y_t = (X_1\cdot d_1)\beta_1 + (X_2\cdot d_2)\beta_2 + d_1\cdot u_1 + d_2\cdot u_2$$ where $d_1$ is a dummy which equals one for the period pre day 150 and $d_2$ is the post day 150 dummy. This can be re-written as $$y_t = X_t\beta_1 + d_2\cdot X_2(\beta_2 - \beta_1) + d_1\cdot u_1 + d_2\cdot u_2$$
generate a dummy which is 1 after day 150 and zero otherwise, interact it with your explanatory variable and then regress your dependent variable on your explanatory variable, the dummy and the interaction. When you regress $$y_t = \alpha + \beta_1 X_t + \beta_2 d_t + \beta_3 (X_t \cdot d_t) + e_t$$ this allows you to model the structural break and in addition you can perform an F-test on $\beta_2$ and $\beta_3$ to see whether your slope for $X_t$ is actually different between your two periods. This is usually referred to as the Chow test.