Extreme Optimization™: Complexity made simple.

Math and Statistics
Libraries for .NET

  • Home
  • Features
    • Math Library
    • Vector and Matrix Library
    • Statistics Library
    • Performance
    • Usability
  • Documentation
    • Introduction
    • Math Library User's Guide
    • Vector and Matrix Library User's Guide
    • Data Analysis Library User's Guide
    • Statistics Library User's Guide
    • Reference
  • Resources
    • Downloads
    • QuickStart Samples
    • Sample Applications
    • Frequently Asked Questions
    • Technical Support
  • Blog
  • Order
  • Company
    • About us
    • Testimonials
    • Customers
    • Press Releases
    • Careers
    • Partners
    • Contact us
Introduction
Deployment Guide
Nuget packages
Configuration
Using Parallelism
Expand Mathematics Library User's GuideMathematics Library User's Guide
Expand Vector and Matrix Library User's GuideVector and Matrix Library User's Guide
Expand Data Analysis Library User's GuideData Analysis Library User's Guide
Expand Statistics Library User's GuideStatistics Library User's Guide
Expand Data Access Library User's GuideData Access Library User's Guide
Expand ReferenceReference
  • Extreme Optimization
    • Features
    • Solutions
    • Documentation
    • QuickStart Samples
    • Sample Applications
    • Downloads
    • Technical Support
    • Download trial
    • How to buy
    • Blog
    • Company
    • Resources
  • Documentation
    • Introduction
    • Deployment Guide
    • Nuget packages
    • Configuration
    • Using Parallelism
    • Mathematics Library User's Guide
    • Vector and Matrix Library User's Guide
    • Data Analysis Library User's Guide
    • Statistics Library User's Guide
    • Data Access Library User's Guide
    • Reference
  • Statistics Library User's Guide
    • Statistical Variables
    • Numerical Variables
    • Statistical Models
    • Regression Analysis
    • Analysis of Variance
    • Time Series Analysis
    • Multivariate Analysis
    • Continuous Distributions
    • Discrete Distributions
    • Multivariate Distributions
    • Kernel Density Estimation
    • Hypothesis Tests
    • Appendices
  • Time Series Analysis
    • Exponential Smoothing
    • ARIMA Models
    • GARCH Models
    • Other Time Series Functions
  • 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.

Creating Exponential Smoothing Models

The constructor of the ExponentialSmoothingModel class takes two arguments. The first is a VectorT that contains the time series data. The second argument determines the smoothing method that is to be used. It is of type ExponentialSmoothingMethod, and can take on the following values:

ExponentialSmoothingMethod values

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:

C#
VB
C++
F#
Copy
var model1 = new ExponentialSmoothingModel(y, ExponentialSmoothingMethod.Single);
Dim model1 = New ExponentialSmoothingModel(y, ExponentialSmoothingMethod.Single)

No code example is currently available or this language may not be supported.

let model1 = new ExponentialSmoothingModel(y, ExponentialSmoothingMethod.Single)

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:

ExponentialSmoothingTrendEstimator values

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:

C#
VB
C++
F#
Copy
var model2 = new ExponentialSmoothingModel(y, ExponentialSmoothingMethod.Double);
model2.TrendEstimator = ExponentialSmoothingTrendEstimator.Initial2;
Dim model2 = New ExponentialSmoothingModel(y, ExponentialSmoothingMethod.Double)
model2.TrendEstimator = ExponentialSmoothingTrendEstimator.Initial2

No code example is currently available or this language may not be supported.

let model2 = new ExponentialSmoothingModel(y, ExponentialSmoothingMethod.Double)
model2.TrendEstimator <- ExponentialSmoothingTrendEstimator.Initial2
Computing the Model

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 ParameterT, and can be used to obtain a wide range of information about the computed values, including the standard error, significance tests and confidence intervals. If you only need the values of the parameters, the ParameterValues property can be used.

C#
VB
C++
F#
Copy
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);
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)

No code example is currently available or this language may not be supported.

model2.Fit()
printfn "Trend: %f" model2.Parameters.[1].Value
printfn "Std.Err.: %f" model2.Parameters.[1].StandardError
printfn "t: %f" model2.Parameters.[1].Statistic
printfn "%A" model2.ParameterValues
Forecasting

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 VectorT that contains the point forecast for the specified number of periods:

C#
VB
C++
F#
Copy
var forecast = model2.Forecast(4);
Dim forecast = model2.Forecast(4)

No code example is currently available or this language may not be supported.

let forecast = model2.Forecast(4)
See Also

Reference

TimeSeriesModelT
ExponentialSmoothingModel

Copyright (c) 2004-2021 ExoAnalytics Inc.

Send comments on this topic to support@extremeoptimization.com

Copyright © 2004-2021, 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.