0

I have transformed my data to be expressed as cost per day. This was to eliminate any seasonality type affects month over month due to holidays, etc.

What I would like to do now is remove the trend from this data set (upward trend) to calculate a historical average daily cost. I'd prefer to stick with an easier to understand method and have been trying to us a 2x12 moving average to calculate trend.

Using either the additive or multiplicative method then suggests subtracting or dividing the moving average from my observation. This then leaves a small residual amount.

The problem is, I am trying to find a historical average without the trend included. Is there a better way to go about doing this?

  • Could you explain the intended meaning of "historical average without the trend included"? What could that possibly be? – whuber Jul 10 '20 at 21:19
  • @whuber sorry, trying to get an average cost per day. Over time the cost trended upward (not for inflation or anything) for about a year before coming back down. As a result the cost per day in the middle of the series is greater than that at the start or end. Looking to tease out that upward/downward trend if possible – Ryan Wilkinson Jul 10 '20 at 21:30
  • Generally, this is an extremely broad question having as many solutions as there are models that could be proposed. There are a great many ways to go about doing this. One nearly mindless automated method is called [STL decomposition](https://en.wikipedia.org/wiki/Decomposition_of_time_series). Here on CV check out https://stats.stackexchange.com/questions/298560 and https://stats.stackexchange.com/questions/85987. Another thread suggests a GAM instead, https://stats.stackexchange.com/questions/9506/. – whuber Jul 10 '20 at 21:44
  • @whuber I am trying to follow a simple additive model like you suggested STL. The problem I am having is taking on the trend component. Most methods recommend trend as the moving average which is obviously a big part of the actual number. – Ryan Wilkinson Jul 13 '20 at 19:24
  • Are you saying you don't believe the STL trend estimate? What is the evidence leading you to suspect that? – whuber Jul 13 '20 at 19:26
  • @whuber Per the STL trend estimate, the number I would be using as my "average" is the moving average at each point correct? I think it's coming together for me. Effectively that is the historical average and everything else is just noise. – Ryan Wilkinson Jul 13 '20 at 23:44
  • I don't really know what you mean by "the" moving average, because there are so many versions of that. STL uses several iterative passes of a lowess smoother. This isn't really a moving average except in a very general sense. It was designed to remove the apparent "noise" from any sequence of numbers in a robust way. – whuber Jul 14 '20 at 12:26

1 Answers1

0

This topic was discussed previously on QuantStatExchange here.

Some of my take-ways together with my knowledge include:

  • Start by assuming the data follows a Log-normal distribution, so that it makes sense to apply the suggested de-trending formula:

$${Log(CurrentPrice/LastPrice) - Average(Log(CurrentPrice/LastPrice)}$$

  • De-trend for the frequency scale of interest.

  • Finally, note a possible purpose for detrending so as to satisfy the null hypothesis for an application of a bootstrap test, wherein the historical mean should be zero. This is accomplished by detrending the entire data series removing any long term trend, followed by subtracting the average return. This creates the so-called zero centered adjustment as cited in the EBTA book.

AJKOER
  • 1,800
  • 1
  • 9
  • 9