0
$\begingroup$

I was reading through this example of a regression model fit to beer sales data link. After the log transformations on the data (which make sense how they correct for the compoundingly larger variance on one end of the range vs the other) they comment near the bottom that the one thing remaining is a "linear trend in the errors" and some auto-correlation. They mention that adding a time index addresses this but I'm not sure I understood how. If sales tend to increase as the year progresses then it would make sense to add a time index to capture that but in here at the bottom it's more of an increase through the summer followed by a decrease - which is nonlinear - how did adding the time index fix both the uptrend and the downtrend in one go? Any references for this 'time index technique' I can further read about?

For reference the "final model" was:

$$\log(S_{18}) = b_0 + b_1 \log(P_{18}) + b_2 \log(P_{12}) + b_3 \log(P_{30}) + b_4 W + \epsilon$$

Where $S_{18}$ is sales of 18-packs of beer, and the $P$'s represent log prices of $12$,$18$, and $30$ packs (the $12$ and $30$ are substitution goods for cross price elasticity effects). Then the "reduction of the linear trend in errors" comes about by adding $W$ which is simply what week of the year $1-52$ we are in.

$\endgroup$
  • $\begingroup$ Could you write out the model? I think that would help a lot. In particular, is this 'time index' a single 'time' variable, or is there a free parameter for each interval? $\endgroup$ – one_observation Jan 11 '16 at 3:07
  • $\begingroup$ Added, it's the week of the year, I believe there was an observation recorded for each week of the year in the original data $\endgroup$ – Palace Chan Jan 11 '16 at 3:13
1
$\begingroup$

Here's what I see going on:

First of all, the plot at the very bottom isn't of the data that's being analyzed. It says it's of a "much larger sample of stores." For whatever reason, the sample you have may not display all the same patterns. In fact, the link does make the claim that there is "no evidence of seasonality" in the data that is analyzed (although I'll come back to that, since I don't agree).

The reason it appears to be helpful to add the 'time index' can be seen in the third plot on the page. There, you can see the errors (more or less) only increase, over the course of the year. So they add a variable that also increases (time) to deal with it. Keep in mind this is different from sales going up, then down -- they're only talking about the amount by which they mis-predict.

In other words, to get rid of a trend of increasing error (not increasing in terms of absolute value, but increasing in a simple numeric way), the author simply adds a random increasing variable to 'explain' that portion of the error they couldn't get before. That's why it "works."

I put that in quotation marks of course because in the data itself, there doesn't seem to be a linear time trend at all, and the new variable appears to work more for numeric reasons than truly explanatory ones (isn't really a good fit). It looks much more like there is A time-based trend, but it's exactly the one in the bottom plot -- spikes around major drinking holidays, with the biggest one in the summer. Some differences, yes, and no subtle hump, like in the bottom -- but, first, it's different data, and second, that's a much better approximation to what I see than anything linear that their simple W gets at.

To properly include time, I would have 'holiday' indicators for each week with one of the known drinking peaks, and see how that works. Otherwise, I really don't like their model at all.

$\endgroup$
  • $\begingroup$ To add on your answer, adding a time trend does not increase the economic interpretation: it simply is that an monotonically increasing vector captures part of the variation. But how do we intepret that ? That is a question that is not addressed here. In essence, it is simply detrending the data prior to analysis. $\endgroup$ – user89073 Jan 11 '16 at 9:00

Your Answer

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

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