## Saturday, November 28, 2009

### Exponential Smoothing

Someone mentioned a method to get an optimal value for parameter α in the exponential smoothing algorithm (http://en.wikipedia.org/wiki/Exponential_smoothing). Looking at http://shazam.econ.ubc.ca/intro/expsmth1.htm this probably very often gives α=1. On pure intuition, I suspect this has something to do with the missing constant term in the corresponding ARIMA(0,1,1) model. In GAMS we can reproduce this as:

\$ontext

GAMS code to reproduce

http://shazam.econ.ubc.ca/intro/expsmth1.htm

\$offtext

sets
t
/1931*1960/
t1(t)
/1931*1959/
;

parameter sales(t) /

1931   1806

1932   1644

1933   1814

1934   1770

1935   1518

1936   1103

1937   1266

1938   1473

1939   1423

1940   1767

1941   2161

1942   2336

1943   2602

1944   2518

1945   2637

1946   2177

1947   1920

1948   1910

1949   1984

1950   1787

1951   1689

1952   1866

1953   1896

1954   1684

1955   1633

1956   1657

1957   1569

1958   1390

1959   1387

1960   1289
/;

variables
f(t)
sse
w
;

w.lo = 0.0;
w.up = 1.0;
w.l  = 0.8;

equations
deff(t)
defsse
;

deff(t).. f(t) =e= sales(t)\$(
ord(t)=1) +
[w*sales(t)+(1-w)*f(t-1)]\$(
ord(t)>1);

defsse.. sse =e=
sum(t1(t),sqr(f(t)-sales(t+1)));

model m/all/;
solve m minimizing sse using nlp;

parameter result;
result(
'opt','w') = w.l;
result(
'opt','SSE') = sse.l;

set i/i1*i4/;
parameters wx(i) /

i1 0.8

i2 0.6

i3 0.4

i4 0.2

/;
loop(i,
w.fx = wx(i);

solve m minimizing sse using nlp;
result(i,
'w') = w.l;
result(i,
'SSE') = sse.l;
);
display result;

Indeed this gives the following result:

----     90 PARAMETER result

w         SSE

opt       1.000 1222283.000
i1        0.800 1405768.565
i2        0.600 1761367.108
i3        0.400 2421085.784
i4        0.200 3570106.711

Note: the initial value for w (w.l  = 0.8;) is important. If we leave that statement out, CONOPT will not be able to move w away from its default initial value of zero.