Database Reference
In-Depth Information
forecast(1.0); }
public double
update(
double
y) {
double
e = error(y);
level = level + trend + a*e;
trend = trend + a*b*e;
return
e;
}
The seasonal component of this model was later added in what has become
known as the Holt-Winters forecast. There are two types of seasonal models
used in Holt-Winters: additive and multiplicative. Both require two extra
parameters: a seasonal period
s
and a smoothing parameter
g
. In this
example,thelengthoftheperiodispassedinwiththeinitialestimatesofthe
seasonal contribution to the forecast:
public class
SeasonalForecast
extends
HoltForecast {
double
[] s;
double
g = 0.0;
long
t = 0;
public
SeasonalForecast(
double
level,
double
trend,
double
a,
double
b,
double
[] s,
double
g) {
super
(level, trend, a, b);
this
.s = s;
this
.g = g;
this
.t = 0;
}
}
The period of the seasonality in this method must be selected ahead of time,
althoughitisusuallyfairlyintuitive.Formanyoftheclassicalapplicationsof
this method, the period is either 4 or 12 depending on whether the data are
quarterly or monthly outputs. For real-time applications, the period is often
something like hourly or daily, leading to periods of 24 or 7, respectively.
For the additive seasonal forecast, the seasonal estimate for each time
period in the future is added to the output of the Holt forecast:
public class
AdditiveForecast
extends
SeasonalForecast
{
public
AdditiveForecast(
double
level,
double
trend,