'Discounting Old Time Series Values, Exponential Smoothing

I would like to build a time series from another time series, discounting older values. That is, the most recent value is included in the sum normally, and the previous value is discounted with delta^t. Then a new value is added, which is again normally included in the new time series, the older values are then discounted with delta^t and delta^(t-k). The whole thing should look like this:

Data: df<- c(0.4387738, 0.05203873, 0.3238407, 0.1117364)

> test[[1]][["se_ne"]][[1]] 
[1] 0.4387738
> 
> test[[2]][["se_ne"]][[2]] + 0.4^(2-1)*test[[2]][["se_ne"]][[2-1]] 
[1] 0.2275482
> 
> test[[3]][["se_ne"]][[3]] + 0.4^(3-2)*test[[3]][["se_ne"]][[3-1]] + 0.4^(3-1)*test[[3]][["se_ne"]][[3-2]] 
[1] 0.41486

But the dataset has over 700 observations, is there a smarter solution than calculating everything by hand?

Thanks for the feedback!



Solution 1:[1]

Perhaps this SO answer might help you:

Exponential smoothing method

If it does not, then a good next step would be to explain the differences between that post and your question.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Michael Tuchman