I have a time series of customers. Say, every customer has 30 observations of how may items he purchased over a period of 30 months. I would like to add a feature indicating what the general trend of 12 months. For example: on Dec 2019, I will have the trend of the whole 2019 - a "running slope". It helps me to detect customer in incline or decline. The way I do it (in R) is to calculate the slope from linear regression of the last 12 months. The thing is I don't know whether I should calculate it with or without the intercept. Example for two time series:

  1. 1,2,3,4,5,6,7,8,9,10,11,12
  2. 10,12,13,14,100,9,10,11,12,13,14,15

Slope of the first one is 1 and of the second is (-0.7) From business point of view both customers are "on the rise" and I don't get what I want.

If I give up the slope, the second time series gets 2.17 which maybe better reflects the differences, yet I'm aware that it is almost never recommended.

Am I approaching it correctly? Should other calculation take place when one wants to analyze customer's "direction"?

  • 1
    $\begingroup$ Making the intercept zero here will make every slope positive no matter what since you don't have negative items, so probably won't be very helpful. Instead, using robust methods for regression should be able to pick up that the trend is generally increasing in the case of customer 2 by being less sensitive to the unusual 5th observation. $\endgroup$ – Chris Haug Aug 4 '20 at 16:01
  • 3
    $\begingroup$ Does this answer your question? When is it ok to remove the intercept in a linear regression model? $\endgroup$ – Adrian Keister Aug 4 '20 at 17:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.