Home»Documentation»Statistics Library User's Guide»Time Series Analysis»Exponential Smoothing

## Exponential Smoothing | Extreme Optimization Numerical Libraries for .NET Professional |

Exponential smoothing is a general method for removing noise from a data series, or producing a short term forecast of time series data.

Single exponential smoothing is equivalent to computing an exponential moving average. The smoothing parameter is determined automatically, by minimizing the squared difference between the actual and the forecast values. Double exponential smoothing introduces a linear trend, and so takes two arguments.

Exponential smoothing is implemented by the ExponentialSmoothingModel class. A variety of methods is available, including single and double exponential smoothing.

The constructor of the ExponentialSmoothingModel
class takes two arguments. The first is a
Vector

Value | Description |
---|---|

Single | Use single exponential smoothing. |

Double | Use double exponential smoothing. |

For single exponential smoothing models, this is all that is required. The example below creates a single exponential smoothing model for a vector y:

For double exponential smoothing models, the TrendEstimator property, of type ExponentialSmoothingTrendEstimator determines how the initial value for the trend is determined. Its possible values are as follows:

Value | Description |
---|---|

Initial | The difference between the first two observations is taken as the initial value. |

Initial2 | The average difference between the first two pairs of observations is taken as the initial value. |

Initial3 | The average difference between the first three pairs of observations is taken as the initial value. |

Total | The average difference between all pairs of observations is taken as the initial value. |

The code below creates a double exponential smoothing model that uses the first 2 observations to initialize the trend:

var model2 = new ExponentialSmoothingModel(y, ExponentialSmoothingMethod.Double); model2.TrendEstimator = ExponentialSmoothingTrendEstimator.Initial2;

The Compute method finds the parameter values that minimize the squared error of the forecast.

The parameters of the model can be retrieved through the
Parameters
collection. The first argument is the smoothing parameter. For double
smoothing, the second parameter represents the trend.
The members of this collection are of type
Parameter

model2.Fit(); Console.WriteLine("Trend: {0}", model2.Parameters[1].Value); Console.WriteLine("Std.Err.: {0}", model2.Parameters[1].StandardError); Console.WriteLine("t: {0}", model2.Parameters[1].Statistic); Console.WriteLine(model2.ParameterValues);

Once the model has been computed, the Forecast method can then be used to forecast new values. This method has three overloads.

Without arguments, the method returns the one step ahead forecast based on
the computed model. With a single argument, it computes a point forecast
the specified number of steps ahead. It returns a
Vector

#### Reference

Copyright Â© 2004-2023,
Extreme Optimization. All rights reserved.

*Extreme Optimization,* *Complexity made simple*, *M#*, and *M
Sharp* are trademarks of ExoAnalytics Inc.

*Microsoft*, *Visual C#, Visual Basic, Visual Studio*, *Visual
Studio.NET*, and the *Optimized for Visual Studio* logo

are
registered trademarks of Microsoft Corporation.