Time Series Forecasting - Part 3

Double Exponential Smoothing - Excel : SAS : R

In the previous article of this series, we described Single Exponential Smoothing method and its applicability.
Let's now learn the second method which is DES, its applicability and how to perform it in Excel, SAS and R.

You HAVE TO read the following articles before reading this one, else it would not make much sense.

Time Series Forecasting - Part 1

Time Series Forecasting - Part 2

Double Exponential Smoothing (DES)

The method is used for a time series with NO SEASONALITY but with Linear TREND, such series are generally not very usual but little interesting as we would learn to deal with trend, so let's learn it.

DES using Excel

Please download the file to understand the calculation of DES better .

DES Demo File

click to enlarge
Mathematical Equations for DES

The value of α and β lies between 0 and 1.

You can see that, calculations of Level and Slope (Trend) for first observations i.e. in cells F3 and G3 of sheet DES Calculations are exceptional, second equation onward equations as shown to the right have been used.

Rest remains same, you need to check MAPE for accuracy of forecast.

DES using SASDownload the csv file for using in SAS and R codes :

/* first import the time series data*/

Proc import datafile = "G:\AA\Time Series\DES sales.csv"
out = data_1     dbms = csv replace; Run;

/*  then use the Proc Forecast*/

METHOD = WINTER   /* use for DES*/
TREND = 2 /* fit a linear trend model for DES */   
INTERVAL= month /* frequency of input time series*/
WEIGHT= (0.1, 0.2) /* Alpha and Beta VALUE, should be specified in that order between  0 to 1 */
LEAD=1                    /* number of forecast periods*/
OUT = pred_results   /* Check forecaste values here*/
OUTEST = model_stats; /*  check MAPE here*/
VAR Sales;

Run the code and check the results.

DES using R

setwd("G:\\AA\\Time Series")
data = read.csv("DES sales.csv")

# let's make the series a time series compatible to R
ts = ts(data$Sales, start=c(2010, 1), end=c(2012,12), frequency=12)

# Lets decompose the series and see if any trend or seasonality is there.
fit = stl(ts, s.window="period")

# we need to install and use the package forecast
if(!require(forecast)) install.packages("forecast")

# let's now learn plotting classical seasonality plot

# In these plots, we see if the series move together or not. If they do, they are seasonal, well in our case, definitely there is no seasonality. Not showing here as we have shown these plots earlier.

# now let use DES to forecast
fit_1 = HoltWinters(ts, gamma=FALSE)

forecast(fit_1, 1)
plot(forecast(fit_1, 1))

# and it is done !

In the subsequent articles of the series, we would cover other forecasting techniques enlisted in the first article of the series, till then ...

Enjoy reading our other articles and stay tuned with us.

Kindly do provide your feedback in the 'Comments' Section and share as much as possible.

The article has been written by Suyash Nigam with Rajat Agarwal as a co-author.