Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

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.

enter image description here

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.

share|improve this question
    
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

1 Answer 1

up vote 6 down vote accepted

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$$

How to do this in practice:
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.

share|improve this answer
    
could you show implementation of this dummy trick in R? –  Yehoshaphat Schellekens Sep 14 at 11:22
    
I don't know R but once one knows how to generate a dummy variable and how to multiply two variables, then this is already it. –  Andy Sep 14 at 15:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.