SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.stats.timeseries.univariate.realtime
Class SimpleTimeSeries

java.lang.Object
  extended by com.numericalmethod.suanshu.stats.timeseries.univariate.realtime.SimpleTimeSeries
All Implemented Interfaces:
TimeSeries<java.lang.Integer,java.lang.Double>
Direct Known Subclasses:
AdditiveModel, ArimaSim, GarchSim, MultiplicativeModel

public class SimpleTimeSeries
extends java.lang.Object
implements TimeSeries

A simple time series has its values indexed by integers. Data are assumed to be equally spaced.

This time of series is often seen in classical time series analysis.


Nested Class Summary
 class SimpleTimeSeries.Iterator
          the Iterator to read a SimpleTimeSeries
 
Nested classes/interfaces inherited from interface com.numericalmethod.suanshu.stats.timeseries.univariate.realtime.TimeSeries
TimeSeries.Entry
 
Constructor Summary
SimpleTimeSeries(double[] values)
          Construct a SimpleTimeSeries from an array of values.
 
Method Summary
 SimpleTimeSeries diff(int d)
          Construct a new and independent SimpleTimeSeries by taking the first difference.
 SimpleTimeSeries drop(int nItems)
          Construct a new and independent SimpleTimeSeries by dropping the leading nItems entries.
 boolean equals(java.lang.Object obj)
           
 double get(int t)
          Get the value at time t.
 int hashCode()
           
 SimpleTimeSeries.Iterator iterator()
          Get an Iterator to read this integer-indexed univariate time series.
 SimpleTimeSeries lag(int nLags)
          Construct a new and independent SimpleTimeSeries by lagging the time series.
 SimpleTimeSeries lag(int nLags, int length)
          Construct a new and independent SimpleTimeSeries by lagging the time series.
 int size()
          the length of the time series
 double[] toArray()
          Convert this time series into an array.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleTimeSeries

public SimpleTimeSeries(double[] values)
Construct a SimpleTimeSeries from an array of values.

Parameters:
values - an array of values
Method Detail

iterator

public SimpleTimeSeries.Iterator iterator()
Description copied from interface: TimeSeries
Get an Iterator to read this integer-indexed univariate time series.

Specified by:
iterator in interface TimeSeries<java.lang.Integer,java.lang.Double>
Returns:
an iterator

size

public int size()
Description copied from interface: TimeSeries
the length of the time series

Specified by:
size in interface TimeSeries<java.lang.Integer,java.lang.Double>
Returns:
the size

toArray

public double[] toArray()
Description copied from interface: TimeSeries
Convert this time series into an array.

Returns:
the array representation of the time series

get

public double get(int t)
Description copied from interface: TimeSeries
Get the value at time t.

Parameters:
t - the time index, ranging from 1 up to T
Returns:
ts[t]

drop

public SimpleTimeSeries drop(int nItems)
Construct a new and independent SimpleTimeSeries by dropping the leading nItems entries.

Parameters:
nItems - the number of leading entries to be dropped
Returns:
a new and independent time series

diff

public SimpleTimeSeries diff(int d)
Construct a new and independent SimpleTimeSeries by taking the first difference.

Parameters:
d - the number of differences
Returns:
diff(x, lag = 1, differences = d) as in R

lag

public SimpleTimeSeries lag(int nLags,
                            int length)
Construct a new and independent SimpleTimeSeries by lagging the time series.

This only makes sense for equi-distant data points.

Parameters:
nLags - the number of lags
length - the length of the lagged time series
Returns:
a lagged time series

lag

public SimpleTimeSeries lag(int nLags)
Construct a new and independent SimpleTimeSeries by lagging the time series.

This only makes sense for equi-distant data points.

Parameters:
nLags - the number of lags
Returns:
a lagged time series

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

SuanShu, a Java numerical and statistical library

Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.