Class MultivariateGenericTimeTimeSeries<T extends Comparable<? super T>>
- java.lang.Object
-
- dev.nm.stat.timeseries.datastructure.multivariate.MultivariateGenericTimeTimeSeries<T>
-
- Type Parameters:
T- the timestamp type
- All Implemented Interfaces:
MultivariateTimeSeries<T,MultivariateTimeSeries.Entry<T>>,TimeSeries<T,Vector,MultivariateTimeSeries.Entry<T>>,Iterable<MultivariateTimeSeries.Entry<T>>
public class MultivariateGenericTimeTimeSeries<T extends Comparable<? super T>> extends Object implements MultivariateTimeSeries<T,MultivariateTimeSeries.Entry<T>>
This is a multivariate time series indexed by some notion of time. This implementation explicitly remembers all data in memory. It is appropriate for a short time series.- See Also:
- Wikipedia: Time series
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface dev.nm.stat.timeseries.datastructure.multivariate.MultivariateTimeSeries
MultivariateTimeSeries.Entry<T>
-
-
Constructor Summary
Constructors Constructor Description MultivariateGenericTimeTimeSeries(T[] timestamps, double[][] values)Construct a multivariate time series from timestamps and vectors.MultivariateGenericTimeTimeSeries(T[] timestamps, Matrix values)Construct a multivariate time series from timestamps and vectors.MultivariateGenericTimeTimeSeries(T[] timestamps, Vector[] values)Construct a multivariate time series from timestamps and vectors.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MultivariateGenericTimeTimeSeries<T>diff(int d)Construct an instance ofMultivariateGenericTimeTimeSeriesby taking the first differencedtimes.intdimension()Get the dimension of the multivariate time series.MultivariateGenericTimeTimeSeries<T>drop(int nItems)Construct an instance ofMultivariateGenericTimeTimeSeriesby dropping the leadingnItemsentries, those most backward in time entries.booleanequals(Object obj)Vectorget(int i)Get the i-th value.inthashCode()Iterator<MultivariateTimeSeries.Entry<T>>iterator()intsize()Get the length of the time series.Ttime(int i)Get the i-th timestamp.T[]timestamps()Get all the timestamps.Vector[]toArray()Convert this multivariate time series into an array of vectors.MatrixtoMatrix()Convert this multivariate time series into an m x n matrix, where m is the dimension, and n the length.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
-
-
-
-
Constructor Detail
-
MultivariateGenericTimeTimeSeries
public MultivariateGenericTimeTimeSeries(T[] timestamps, Vector[] values)
Construct a multivariate time series from timestamps and vectors.- Parameters:
timestamps- the timestampsvalues- the vector values
-
MultivariateGenericTimeTimeSeries
public MultivariateGenericTimeTimeSeries(T[] timestamps, double[][] values)
Construct a multivariate time series from timestamps and vectors.- Parameters:
timestamps- the timestampsvalues- the vector values
-
-
Method Detail
-
dimension
public int dimension()
Description copied from interface:MultivariateTimeSeriesGet the dimension of the multivariate time series.- Specified by:
dimensionin interfaceMultivariateTimeSeries<T extends Comparable<? super T>,MultivariateTimeSeries.Entry<T extends Comparable<? super T>>>- Returns:
- the multivariate time series dimension
-
size
public int size()
Description copied from interface:TimeSeriesGet the length of the time series.- Specified by:
sizein interfaceTimeSeries<T extends Comparable<? super T>,Vector,MultivariateTimeSeries.Entry<T extends Comparable<? super T>>>- Returns:
- the time series length
-
iterator
public Iterator<MultivariateTimeSeries.Entry<T>> iterator()
- Specified by:
iteratorin interfaceIterable<T extends Comparable<? super T>>
-
toMatrix
public Matrix toMatrix()
Description copied from interface:MultivariateTimeSeriesConvert this multivariate time series into an m x n matrix, where m is the dimension, and n the length.- Specified by:
toMatrixin interfaceMultivariateTimeSeries<T extends Comparable<? super T>,MultivariateTimeSeries.Entry<T extends Comparable<? super T>>>- Returns:
- the matrix representation of this time series
-
toArray
public Vector[] toArray()
Convert this multivariate time series into an array of vectors.- Returns:
- the array representation of this time series
-
get
public Vector get(int i)
Get the i-th value.- Parameters:
i- the position index- Returns:
- the i-th value
-
time
public T time(int i)
Get the i-th timestamp.- Parameters:
i- the position index- Returns:
- the i-th timestamp
-
timestamps
public T[] timestamps()
Get all the timestamps.- Returns:
- the timestamps
-
drop
public MultivariateGenericTimeTimeSeries<T> drop(int nItems)
Construct an instance ofMultivariateGenericTimeTimeSeriesby dropping the leadingnItemsentries, those most backward in time entries.- Parameters:
nItems- the number of leading entries to be dropped- Returns:
- an instance of
MultivariateGenericTimeTimeSeries
-
diff
public MultivariateGenericTimeTimeSeries<T> diff(int d)
Construct an instance ofMultivariateGenericTimeTimeSeriesby taking the first differencedtimes.- Parameters:
d- the number of differences- Returns:
diff(x, lag = 1, differences = d)as in DoubleUtils
-
-