The Exponential Smoothing Functions
We provide functions for exponential smoothing . These are primarily for
simple exponential smoothing and for Holt-Winters variants
- sex1(series,k): A utility function wich gives mse for given parameter a
and for k>4
series values. It starts with the mean of first 4. Note we suppose a is in
[0,1] the function does not checkthat this is true.
- tec1(x,k): plots the sum of squares error for a simple exponential smoother of length k, that is it uses k terms in the computation of the mse.
It did not seem worth hooking up a minimiser since the minimum can be read
off the graph.
-
sex2 (series, a, b, k) : Computes the sum of squares error for a two parameter Holt Winter, trend
included for k points, parameters a and b. Starting values are zero
Note a and b are not checked for size!
- eforecast2(series, k) : This hooks a minimizer to the two parameter
Holt-Winters model with no seasonal. k is the number of terms used.
- eforecast2b(series, k,v=c(0.5,0.6)) : This hooks a minimizer to the two parameter
Holt-Winters model with no seasonal. k is the number of terms. The
function is as forecast2 except that the values
of a and b are constrained. The user can supply the initial value v.
- look(series,k): gives an idea of the ss surface by printing the matrix
of mean square errors for parameter values i and j in increments of 0.1.
- clook<(x,k):gives an idea of the sum of squares surface using contours
and zero start up values.
- sex3(x, a, b, k) :Two parameter Holt Winter sum of squares function ,
mean,trend included for startup.
- look2(series,k): gives an idea of the ss surface by printing the matrix
of mean sqrare errors for parameter values i and j in increments of 0.1.
Uses sex3 i.e. startup is non zero.
- clook2<(x,k):gives an idea of the sum of squares surface using contours
uses sex3 i.e. start up values
- eforecast3b(yseries, k,v=c(0.5,0.5)) :This hooks minimizer to esmoother
function sex3 i.e. startup values
Updates 11-04-01
I was asked to povide a seasonal Holt Winters (thanks bmelo) so here it is.
It is a bit of a cobble up but and uses
- cyc- a utility function
- sex4- a function which computes the mse for this case
- eforecast5(yseries,s, k)- Give this the series "yseries"- the number of terms for
estimation and the seasonal cycle s .
For the code go here