|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.openforecast.models.AbstractForecastingModel net.sourceforge.openforecast.models.AbstractTimeBasedModel
public abstract class AbstractTimeBasedModel
A time based forecasting model is the base class that implements much of the common code for models based on a time series. In particular, it was designed to support the needs of the Weighted Moving Average, as well as the Single, Double and Triple Exponential Smoothing models.
These models have an advantage over other forecasting models in that they smooth out peaks and troughs (or valleys) in a set of observations. However, they also have several disadvantages. In particular these models do not produce an actual equation. Therefore, they often are not all that useful as medium-long range forecasting tools. They can only reliably be used to forecast a few periods into the future.
Field Summary |
---|
Fields inherited from class net.sourceforge.openforecast.models.AbstractForecastingModel |
---|
accuracyIndicators, initialized |
Constructor Summary | |
---|---|
AbstractTimeBasedModel()
Constructs a new time based forecasting model. |
|
AbstractTimeBasedModel(String timeVariable)
Deprecated. As of 0.4, replaced by AbstractTimeBasedModel(java.lang.String) . |
Method Summary | |
---|---|
double |
forecast(DataPoint dataPoint)
Using the current model parameters (initialized in init), apply the forecast model to the given data point. |
protected abstract double |
forecast(double timeValue)
Returns the forecast value of the dependent variable for the given value of the independent time variable. |
String |
getForecastType()
Returns a one or two word name of this type of forecasting model. |
protected double |
getForecastValue(double timeValue)
Returns the forecast value for the dependent variable for the given value of the independent time variable. |
String |
getIndependentVariable()
Returns the independent variable - or the time variable - used in this model. |
double |
getMaximumTimeValue()
Returns the maximum value of the independent time variable currently forecast by this model. |
double |
getMinimumTimeValue()
Returns the minimum value of the independent time variable currently forecast by this model. |
protected abstract int |
getNumberOfPeriods()
Returns the current number of periods used in this model. |
protected double |
getObservedValue(double timeValue)
Returns the observed value of the dependent variable for the given value of the independent time variable. |
protected double |
getTimeInterval()
Returns the current time interval between observations. |
String |
getTimeVariable()
Returns the name of the independent variable representing the time value used by this model. |
void |
init(DataSet dataSet)
Used to initialize the time based model. |
protected void |
initTimeVariable(DataSet dataSet)
Initializes the time variable from the given data set. |
String |
toString()
This should be overridden to provide a textual description of the current forecasting model including, where possible, any derived parameters used. |
Methods inherited from class net.sourceforge.openforecast.models.AbstractForecastingModel |
---|
calculateAccuracyIndicators, forecast, getAIC, getBias, getMAD, getMAPE, getMSE, getSAE |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface net.sourceforge.openforecast.ForecastingModel |
---|
getNumberOfPredictors |
Constructor Detail |
---|
public AbstractTimeBasedModel()
public AbstractTimeBasedModel(String timeVariable)
AbstractTimeBasedModel(java.lang.String)
.
timeVariable
- the name of the independent variable to use as the
time variable in this model.Method Detail |
---|
protected abstract int getNumberOfPeriods()
public void init(DataSet dataSet)
dataSet
- a data set of observations that can be used to initialize
the forecasting parameters of the forecasting model.protected void initTimeVariable(DataSet dataSet) throws IllegalArgumentException
dataSet
- the data set to use to initialize the time variable.
IllegalArgumentException
- If more than one independent variable
is defined for the data set and no time variable has been specified. To
correct this, be sure to explicitly specify the time variable in the
data set passed to init(net.sourceforge.openforecast.DataSet)
.public double forecast(DataPoint dataPoint) throws IllegalArgumentException
dataPoint
- the data point for which a forecast value (for the
dependent variable) is required.
ModelNotInitializedException
- if forecast is called before the
model has been initialized with a call to init.
IllegalArgumentException
- if the forecast period specified by
the dataPoint is invalid with respect to the historical data
provided.protected abstract double forecast(double timeValue) throws IllegalArgumentException
timeValue
- the value of the time variable for which a forecast
value is required.
IllegalArgumentException
- if there is insufficient historical
data - observations passed to init - to generate a forecast for the
given time value.protected double getForecastValue(double timeValue) throws IllegalArgumentException
timeValue
- the value of the independent time variable for which
the forecast value is required. This value must be greater than the
minimum time value defined by the observations passed into the init
method.
IllegalArgumentException
- if the given value of the time
variable was not a valid value for forecasts.protected double getObservedValue(double timeValue) throws IllegalArgumentException
timeValue
- the value of the independent time variable for which
the observed value is required.
IllegalArgumentException
- if the given value of the time
variable was not found in the observations originally passed to init.public String getTimeVariable()
public double getMinimumTimeValue()
public double getMaximumTimeValue()
public String getIndependentVariable()
protected double getTimeInterval()
public String getForecastType()
public String toString()
toString
in interface ForecastingModel
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |