|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.openforecast.DataSet
Represents a collection of data points. Data points are either observations of past data (including both the values of the independent variables and the observed value of the dependent variable), or forecasts or estimates of the dependent variable (for a given set of independent variable values).
Generally when trying to forecast future values you'll use two data sets. The first data set contains all of the observations, or historical data. This data set is used to help initialize the selected forecasting model, the details of which depend on the specific forecasting model. A second data set is then created and initialized with data points describing the values of the independent variables that are to be used to predict or forecast values of the dependent variable.
When defining any data set it is important to provide as much information as possible about the data. While on the surface it may seem trivial, the more information you can provide about a data set (such as whether it is a time-based series, the name of the independent variable representing time, the number of data points/periods in a year), the better the forecasting model will be able to model the data. This is because some models need this type of data to even be applicable.
| Constructor Summary | |
DataSet()
Constructs a new empty data set. |
|
DataSet(DataSet dataSet)
Copy constructor: constructs a new data set object by copying the given data set. |
|
DataSet(java.lang.String timeVariable,
int periodsPerYear,
java.util.Collection c)
Constructs a new time-based data set with the named time variable, the given number of data points in a year, and the given Collection of data points. |
|
| Method Summary | |
boolean |
add(java.lang.Object obj)
Adds the given data point object to this data set. |
boolean |
addAll(java.util.Collection c)
Adds a collection of data points to this data set. |
void |
clear()
Removes all of the data points from this data set. |
boolean |
contains(java.lang.Object obj)
Returns true if this data set contains the given data point object; or false otherwise. |
boolean |
containsAll(java.util.Collection c)
Returns true if this DataSet contains all of the DataPoints in the specified collection. |
boolean |
equals(DataSet dataSet)
Indicates whether some other DataSet is "equal to" this one. |
boolean |
equals(java.lang.Object obj)
Indicates whether some other object, obj, is "equal to" this one. |
java.lang.String[] |
getIndependentVariables()
Returns an ordered array of all independent variable names used in this data set. |
int |
getPeriodsPerYear()
Returns the number of periods - or data points - in a years worth of data for time-series data. |
java.lang.String |
getTimeVariable()
Returns the time variable associated with this data set, or null if no time variable has been defined. |
int |
hashCode()
Returns the hash code value for this collection, based on the underlying Collection of DataPoints. |
boolean |
isEmpty()
Returns true if this data set contains no data points. |
java.util.Iterator |
iterator()
Returns an iterator over the data points in this data set. |
boolean |
remove(java.lang.Object obj)
Removes a single instance of the specified data point object from this data set, if it is present. |
boolean |
removeAll(java.util.Collection c)
Not currently implemented - always throws UnsupportedOperationException. |
boolean |
retainAll(java.util.Collection c)
Not currently implemented - always throws UnsupportedOperationException. |
void |
setPeriodsPerYear(int periodsPerYear)
Sets the number of periods - or data points - in a years worth of data for time-series data. |
void |
setTimeVariable(java.lang.String timeVariable)
Sets the name of the time variable for this data set. |
int |
size()
Returns the number of data points in this data set. |
void |
sort(java.lang.String independentVariable)
Sorts the given data set according to increasing value of the named independent variable. |
java.lang.Object[] |
toArray()
Converts the current set of data points to an array of DataPoint objects. |
java.lang.Object[] |
toArray(java.lang.Object[] a)
Converts the current set of data points to an array of DataPoint objects; the runtime type of the returned array is that of the specified array. |
java.lang.String |
toString()
Overrides the default toString method. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public DataSet()
public DataSet(DataSet dataSet)
dataSet - the data set to copy from to initialize the new data set.
public DataSet(java.lang.String timeVariable,
int periodsPerYear,
java.util.Collection c)
timeVariable - the name of the independent variable representing
time.periodsPerYear - the number of periods - data points - in one years
worth of data.c - a Collection of data points to initialize this data set with.setTimeVariable(java.lang.String),
setPeriodsPerYear(int),
addAll(java.util.Collection)| Method Detail |
public boolean add(java.lang.Object obj)
add in interface java.util.Collectionobj - the data point object to add to this set.
java.lang.ClassCastException - if the specified object does not implement
the DataPoint interface.
java.lang.NullPointerException - if the specified collection contains
one or more null elements.public boolean addAll(java.util.Collection c)
addAll in interface java.util.Collectionc - a collection of data points to add to this data set.
public void clear()
clear in interface java.util.Collectionpublic boolean isEmpty()
isEmpty in interface java.util.Collectionpublic boolean contains(java.lang.Object obj)
dataPoint.equals(dp) returns true for some DataPoint
object, dp, within the set of data points.
contains in interface java.util.Collectionobj - the data point object to search for in this data set.
java.lang.ClassCastException - if the specified object does not implement
the DataPoint interface.
java.lang.NullPointerException - if the specified collection contains
one or more null elements.
public boolean containsAll(java.util.Collection c)
throws java.lang.ClassCastException,
java.lang.NullPointerException
containsAll in interface java.util.Collectionc - collection to be checked for containment in this collection.
java.lang.ClassCastException - if the types of one or more elements in
the specified collection do not implement the DataPoint interface.
java.lang.NullPointerException - if the specified collection contains
one or more null elements.public boolean remove(java.lang.Object obj)
remove in interface java.util.Collectionobj - the data point object to remove from this data set.
java.lang.ClassCastException - if the specified object does not implement
the DataPoint interface.
java.lang.NullPointerException - if the specified collection contains
one or more null elements.public int size()
size in interface java.util.Collectionpublic java.util.Iterator iterator()
iterator in interface java.util.Collectionpublic void sort(java.lang.String independentVariable)
independentVariable - the name of the independent variable to
set by. The resulting data set will be sorted in increasing
value of this variable.public java.lang.String[] getIndependentVariables()
public java.lang.Object[] toArray()
toArray in interface java.util.Collectionpublic java.lang.Object[] toArray(java.lang.Object[] a)
toArray in interface java.util.Collectiona - the array into which the elements of this data set are to be
stored, if it is big enough; otherwise, a new array of the same
runtime type is allocated for this purpose.
public void setTimeVariable(java.lang.String timeVariable)
timeVariable - the name of the independent variable that represents
the time data component. For example, this may be something like
"t", "month", "period", "year", and so on.setPeriodsPerYear(int)public java.lang.String getTimeVariable()
null if no time variable has been defined.
public void setPeriodsPerYear(int periodsPerYear)
In addition to setting the number of periods per year, you must also set the time variable otherwise any forecasting model will not be able to consider the potential effects of seasonality.
periodsPerYear - the number of periods in a years worth of data.setTimeVariable(java.lang.String)public int getPeriodsPerYear()
public boolean removeAll(java.util.Collection c)
throws java.lang.UnsupportedOperationException
removeAll in interface java.util.Collectionc - DataPoint objects to be removed from this collection.
java.lang.UnsupportedOperationException - if the removeAll method is not
supported by this collection.
java.lang.ClassCastException - if the types of one or more elements in the
specified DataSet are not DataPoint objects.
java.lang.NullPointerException - if the specified collection contains one
or more null elements.
public boolean retainAll(java.util.Collection c)
throws java.lang.UnsupportedOperationException
retainAll in interface java.util.Collectionc - elements to be retained in this collection.
java.lang.UnsupportedOperationException - if the retainAll method is not
supported by this collection.
java.lang.ClassCastException - if the types of one or more elements in the
specified DataSet are not DataPoint objects.
java.lang.NullPointerException - if the specified collection contains one
or more null elements.public int hashCode()
hashCode in interface java.util.Collectionpublic boolean equals(java.lang.Object obj)
equals(DataSet) returns true; otherwise false.
equals in interface java.util.Collectionobj - the reference object with which to compare.
equals(DataSet)public boolean equals(DataSet dataSet)
dataSet - the reference object with which to compare.
public java.lang.String toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||