# How to de-trend a data set to calculate historical average?

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, 2020 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 Jul 10, 2020 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. 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.
– whuber
Jul 10, 2020 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. Jul 13, 2020 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, 2020 at 19:26

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