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?

  • $\begingroup$ Could you explain the intended meaning of "historical average without the trend included"? What could that possibly be? $\endgroup$
    – whuber
    Jul 10, 2020 at 21:19
  • $\begingroup$ @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 $\endgroup$ Jul 10, 2020 at 21:30
  • $\begingroup$ 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. Here on CV check out stats.stackexchange.com/questions/298560 and stats.stackexchange.com/questions/85987. Another thread suggests a GAM instead, stats.stackexchange.com/questions/9506. $\endgroup$
    – whuber
    Jul 10, 2020 at 21:44
  • $\begingroup$ @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. $\endgroup$ Jul 13, 2020 at 19:24
  • $\begingroup$ Are you saying you don't believe the STL trend estimate? What is the evidence leading you to suspect that? $\endgroup$
    – whuber
    Jul 13, 2020 at 19:26

1 Answer 1


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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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