Class SimpleTimeSeries
- java.lang.Object
-
- dev.nm.stat.timeseries.datastructure.univariate.realtime.inttime.SimpleTimeSeries
-
- All Implemented Interfaces:
TimeSeries<Integer,Double,IntTimeTimeSeries.Entry>,IntTimeTimeSeries,UnivariateTimeSeries<Integer,IntTimeTimeSeries.Entry>,Iterable<IntTimeTimeSeries.Entry>
- Direct Known Subclasses:
AdditiveModel,MultiplicativeModel
public class SimpleTimeSeries extends Object implements IntTimeTimeSeries
This simple univariate time series simply wraps adouble[]to form a time series.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface dev.nm.stat.timeseries.datastructure.univariate.realtime.inttime.IntTimeTimeSeries
IntTimeTimeSeries.Entry
-
-
Constructor Summary
Constructors Constructor Description SimpleTimeSeries(double[] values)Constructs an instance ofSimpleTimeSeries.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SimpleTimeSeriesdiff(int d)Constructs an instance ofSimpleTimeSeriesby taking the first differencedtimes.SimpleTimeSeriesdrop(int nItems)Constructs an instance ofSimpleTimeSeriesby dropping the leadingnItemsentries.booleanequals(Object obj)doubleget(int t)Get the value at timet.inthashCode()Iterator<IntTimeTimeSeries.Entry>iterator()SimpleTimeSerieslag(int nLags)Constructs an instance ofSimpleTimeSeriesby lagging the time series.SimpleTimeSerieslag(int nLags, int length)Constructs an instance ofSimpleTimeSeriesby lagging the time series.intsize()Get the length of the time series.double[]toArray()Convert this time series into an array, discarding the timestamps.StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
size
public int size()
Description copied from interface:TimeSeriesGet the length of the time series.- Specified by:
sizein interfaceTimeSeries<Integer,Double,IntTimeTimeSeries.Entry>- Returns:
- the time series length
-
iterator
public Iterator<IntTimeTimeSeries.Entry> iterator()
- Specified by:
iteratorin interfaceIterable<IntTimeTimeSeries.Entry>
-
toArray
public double[] toArray()
Description copied from interface:UnivariateTimeSeriesConvert this time series into an array, discarding the timestamps.- Specified by:
toArrayin interfaceUnivariateTimeSeries<Integer,IntTimeTimeSeries.Entry>- Returns:
- the array representation of the time series
-
get
public double get(int t)
Description copied from interface:IntTimeTimeSeriesGet the value at timet.- Specified by:
getin interfaceIntTimeTimeSeries- Parameters:
t- a time index, counting from 1- Returns:
- the value at time
t
-
drop
public SimpleTimeSeries drop(int nItems)
Constructs an instance ofSimpleTimeSeriesby dropping the leadingnItemsentries.- Parameters:
nItems- the number of leading entries to be dropped- Returns:
- a
SimpleTimeSeries
-
diff
public SimpleTimeSeries diff(int d)
Constructs an instance ofSimpleTimeSeriesby taking the first differencedtimes.- Parameters:
d- the number of differences- Returns:
diff(x, lag = 1, differences = d)as in DoubleUtils
-
lag
public SimpleTimeSeries lag(int nLags, int length)
Constructs an instance ofSimpleTimeSeriesby lagging the time series. This operation makes sense only for equi-distant data points.- Parameters:
nLags- the number of lagslength- the length of the lagged time series- Returns:
- a lagged time series
-
lag
public SimpleTimeSeries lag(int nLags)
Constructs an instance ofSimpleTimeSeriesby lagging the time series. This operation makes sense only for equi-distant data points.- Parameters:
nLags- the number of lags- Returns:
- a lagged time series
-
-