Exponential smoothing is a simple method to forecast the future given the present and the past. You can use it to forecast sales, revenues, production levels, marketing expenses, the weather, stock prices, and many other things that happend over time. It’s crude so sometimes it doesn’t work well. But sometimes it does work fine, and you can often use it as a data processing tool to smooth out timeseries data before using them to build more complicated models.

Exponential smoothing is essentially a method of weighted averages. Here’s how it works:

- take the current value and weight it by a number (call it alpha) bewtween 0 and 1 (for example, 0.8),
- take the previous value and weight it by 1-alpha (for example, 0.2),
- sum results from step 1 and 2 and use it as an estimate for the next value.

Here’s a function that implements it in R.

In practice, people often weight the current value more heavily than the previous value, and this is based on a common sensical hypothesis that when making predictions about the future, the present matters more than the past. The following example uses `alpha=0.8`

to exponentially smooth a vector of randomly generated numbers from a uniform distribution.