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 SimpleTimeSeries
diff(int d)
Constructs an instance ofSimpleTimeSeries
by taking the first differenced
times.SimpleTimeSeries
drop(int nItems)
Constructs an instance ofSimpleTimeSeries
by dropping the leadingnItems
entries.boolean
equals(Object obj)
double
get(int t)
Get the value at timet
.int
hashCode()
Iterator<IntTimeTimeSeries.Entry>
iterator()
SimpleTimeSeries
lag(int nLags)
Constructs an instance ofSimpleTimeSeries
by lagging the time series.SimpleTimeSeries
lag(int nLags, int length)
Constructs an instance ofSimpleTimeSeries
by lagging the time series.int
size()
Get the length of the time series.double[]
toArray()
Convert this time series into an array, discarding the timestamps.String
toString()
-
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:TimeSeries
Get the length of the time series.- Specified by:
size
in interfaceTimeSeries<Integer,Double,IntTimeTimeSeries.Entry>
- Returns:
- the time series length
-
iterator
public Iterator<IntTimeTimeSeries.Entry> iterator()
- Specified by:
iterator
in interfaceIterable<IntTimeTimeSeries.Entry>
-
toArray
public double[] toArray()
Description copied from interface:UnivariateTimeSeries
Convert this time series into an array, discarding the timestamps.- Specified by:
toArray
in interfaceUnivariateTimeSeries<Integer,IntTimeTimeSeries.Entry>
- Returns:
- the array representation of the time series
-
get
public double get(int t)
Description copied from interface:IntTimeTimeSeries
Get the value at timet
.- Specified by:
get
in interfaceIntTimeTimeSeries
- Parameters:
t
- a time index, counting from 1- Returns:
- the value at time
t
-
drop
public SimpleTimeSeries drop(int nItems)
Constructs an instance ofSimpleTimeSeries
by dropping the leadingnItems
entries.- Parameters:
nItems
- the number of leading entries to be dropped- Returns:
- a
SimpleTimeSeries
-
diff
public SimpleTimeSeries diff(int d)
Constructs an instance ofSimpleTimeSeries
by taking the first differenced
times.- 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 ofSimpleTimeSeries
by 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 ofSimpleTimeSeries
by 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
-
-