| Modifier and Type | Method and Description |
|---|---|
TimeSeries |
aggregate(TimePeriod timePeriod)
Aggregate the time series up to the given time period.
|
TimeSeries |
aggregate(TimeUnit timeUnit)
Aggregate the observations in this series to the given time unit.
|
TimeSeries |
aggregateToYears()
Aggregate the observations in this series to the yearly level.
|
double[] |
asArray()
Retrieve the time series of observations.
|
List<Double> |
asList()
retrieve the observations as a list.
|
double |
at(int index)
Retrieve the value of the time series at the given index.
|
double |
at(OffsetDateTime dateTime)
Retrieve the value of the time series at the given date-time.
|
double |
autoCorrelationAtLag(int k)
The correlation of this series with itself at lag k.
|
double[] |
autoCorrelationUpToLag(int k)
Every correlation coefficient of this series with itself up to the given lag.
|
double |
autoCovarianceAtLag(int k)
The covariance of this series with itself at lag k.
|
double[] |
autoCovarianceUpToLag(int k)
Every covariance measure of this series with itself up to the given lag.
|
TimeSeries |
backTransform(double boxCoxLambda)
Perform the inverse of the Box-Cox transformation on this series and return the result in a new time series.
|
TimeSeries |
centeredMovingAverage(int m)
Return a moving average of order m if m is odd and of order 2 × m if m is even.
|
double |
correlation(DataSet otherData)
The unbiased sample correlation of these observations with the observations
contained in the given data set.
|
double |
covariance(DataSet otherData)
The unbiased sample covariance of these observations with the observations
contained in the given data set.
|
Map<OffsetDateTime,Integer> |
dateTimeIndex()
Retrieve the mapping of observation times to array indices for this series.
|
TimeSeries |
demean()
Remove the mean from this series and return the result as a new time series.
|
TimeSeries |
difference()
Difference this time series once at lag 1 and return the result as a new time series.
|
static double[] |
difference(double[] series,
int times)
Difference the given series the given number of times at lag 1.
|
static double[] |
difference(double[] series,
int lag,
int times)
Difference the given series the given number of times at the given lag.
|
TimeSeries |
difference(int lag)
Difference this time series at the given lag and return the result as a new time series.
|
TimeSeries |
difference(int lag,
int times)
Difference this series the given number of times at the given lag.
|
boolean |
equals(Object o) |
static TimeSeries |
from(double... series)
Create a new time series from the given data without regard to when the observations were made.
|
static TimeSeries |
from(OffsetDateTime startTime,
double... series)
Create a new time series from the given data with the supplied start time.
|
static TimeSeries |
from(TimePeriod timePeriod,
CharSequence startTime,
double... series)
Create a new time series using the given time period, the time of first observation, and observation data.
|
static TimeSeries |
from(TimePeriod timePeriod,
double... series)
Create a new time series using the given time period and observation data.
|
static TimeSeries |
from(TimePeriod timePeriod,
List<OffsetDateTime> observationTimes,
double... series)
Create a new time series with the given time period, observation times, and observation data.
|
static TimeSeries |
from(TimePeriod timePeriod,
OffsetDateTime startTime,
double... series)
Create a new time series with the given time period, the time of first observation, and the observation data.
|
static TimeSeries |
from(TimeUnit timeUnit,
CharSequence startTime,
double... series)
Create a new time series using the given unit of time, the time of first observation, and the observation data.
|
static TimeSeries |
from(TimeUnit timeUnit,
OffsetDateTime startTime,
double... series)
Create a new time series using the given unit of time, the time of first observation, and the observation data.
|
int |
hashCode() |
double |
mean()
The mean of the observations.
|
double |
median()
The median value of the observations.
|
TimeSeries |
minus(double[] otherSeries)
Subtract the given series from this series and return the result as a new time series.
|
TimeSeries |
minus(TimeSeries otherSeries)
Subtract the given series from this time series and return the result as a new time series.
|
TimeSeries |
movingAverage(int m)
Compute a moving average of order m.
|
List<OffsetDateTime> |
observationTimes()
Retrieve the list of observation times for this series.
|
TimeSeries |
plus(DataSet otherData)
Add every element of this data set to the corresponding element of the given data set.
|
void |
print()
Print a descriptive summary of this time series.
|
int |
size()
The size of the data set.
|
TimeSeries |
slice(int start,
int end)
Return a slice of this time series from start (inclusive) to end (inclusive).
|
TimeSeries |
slice(OffsetDateTime start,
OffsetDateTime end)
Return a slice of this time series from start (inclusive) to end (inclusive).
|
OffsetDateTime |
startTime()
The time at which the first observation was made.
|
double |
stdDeviation()
The unbiased sample standard deviation of the observations.
|
double |
sum()
The sum of the observations.
|
double |
sumOfSquares()
The sum of the squared observations.
|
TimePeriod |
timePeriod()
Retrieve the time period at which observations are made for this series.
|
TimeSeries |
times(DataSet otherData)
Multiply every element of this data set with the corresponding element of the given data set.
|
TimeSeries |
timeSlice(int start,
int end)
Return a slice of this time series using R/Julia style indexing.
|
String |
toString() |
TimeSeries |
transform(double boxCoxLambda)
Transform the series using a Box-Cox transformation with the given parameter value.
|
double |
variance()
The unbiased sample variance of the observations.
|
public static TimeSeries from(@NonNull double... series)
series - the observation data.public static TimeSeries from(@NonNull OffsetDateTime startTime, @NonNull double... series)
startTime - the time of the first observation.series - the observation data.public static TimeSeries from(@NonNull TimePeriod timePeriod, @NonNull double... series)
timePeriod - the period of time between observations.series - the observation data.public static TimeSeries from(@NonNull TimePeriod timePeriod, @NonNull CharSequence startTime, @NonNull double... series)
timePeriod - the period of time between observations.startTime - the time of the first observation. The characters must represent either a valid
OffsetDateTime or a valid LocalDateTime. If a LocalDateTime, then the default
UTC/Greenwich offset, i.e., an offset of 0, will be used.series - the observation data.public static TimeSeries from(@NonNull TimePeriod timePeriod, @NonNull List<OffsetDateTime> observationTimes, @NonNull double... series)
timePeriod - the period of time between observations.observationTimes - the observation times.series - the observation data.public static TimeSeries from(@NonNull TimeUnit timeUnit, @NonNull CharSequence startTime, @NonNull double... series)
timeUnit - the unit of time in which observations are made.startTime - the time of the first observation. The characters must represent either a valid
OffsetDateTime or a valid LocalDateTime. If a LocalDateTime, then the default
UTC/Greenwich offset, i.e., an offset of 0, will be used.series - the observation data.public static TimeSeries from(@NonNull TimePeriod timePeriod, @NonNull OffsetDateTime startTime, @NonNull double... series)
timePeriod - the period of time between observations.startTime - the time of the first observation.series - the observation data.public static TimeSeries from(@NonNull TimeUnit timeUnit, @NonNull OffsetDateTime startTime, @NonNull double... series)
timeUnit - the unit of time in which observations are made.startTime - the time of the first observation.series - the observation data.public static double[] difference(@NonNull
double[] series,
int lag,
int times)
series - the series to difference.lag - the lag at which to take differences.times - the number of times to difference the series at the given lag.
Note that this argument may equal 0, in which case a copy of the
original series is returned.IllegalArgumentException - if lag is less than 1.IllegalArgumentException - if times is less than 0.IllegalArgumentException - if the product of lag and times is greater than the length
of the series.public static double[] difference(double[] series,
int times)
series - the series to difference.times - the number of times to difference the series.IllegalArgumentException - if times is less than 0.IllegalArgumentException - if times is greater than the length
of the series.public final TimeSeries aggregateToYears()
public final TimeSeries aggregate(TimeUnit timeUnit)
timeUnit - The time unit to aggregate up to.public final TimeSeries aggregate(@NonNull TimePeriod timePeriod)
timePeriod - the time period to aggregate up to.public final double at(int index)
index - the index of the value to return.public final double at(@NonNull
OffsetDateTime dateTime)
dateTime - the date-time of the value to return.IllegalArgumentException - if there is no observation at the given date-time.public final double autoCorrelationAtLag(int k)
k - the lag to compute the autocorrelation at.IllegalArgumentException - if k is less than 0.public final double[] autoCorrelationUpToLag(int k)
k - the maximum lag to compute the autocorrelation at.IllegalArgumentException - if k is less than 0.public final double autoCovarianceAtLag(int k)
k - the lag to compute the autocovariance at.IllegalArgumentException - if k is less than 0.public final double[] autoCovarianceUpToLag(int k)
k - the maximum lag to compute the autocovariance at.IllegalArgumentException - if k is less than 0.public final TimeSeries transform(double boxCoxLambda)
Setting boxCoxLambda equal to 0 corresponds to the natural logarithm while values other than 0 correspond to power transforms.
See the definition given here.
boxCoxLambda - the parameter to use for the transformation.IllegalArgumentException - if boxCoxLambda is not strictly between -1 and 2.public final TimeSeries backTransform(double boxCoxLambda)
boxCoxLambda - the Box-Cox transformation parameter to use for the inversion.IllegalArgumentException - if boxCoxLambda is not strictly between -1 and 2.public final TimeSeries movingAverage(int m)
m - the order of the moving average.public final TimeSeries centeredMovingAverage(int m)
m - the order of the moving average.public final TimeSeries demean()
public final TimeSeries difference(int lag, int times)
lag - the lag at which to take differences.times - the number of times to difference the series at the given lag.IllegalArgumentException - if lag is less than 1.IllegalArgumentException - if times is less than 0.IllegalArgumentException - if the product of lag and times is greater than the length
of the series.public final TimeSeries difference(int lag)
lag - the lag at which to take differences.IllegalArgumentException - if lag is less than 1.IllegalArgumentException - if lag is greater than the size of this series.public final TimeSeries difference()
public final TimeSeries minus(@NonNull TimeSeries otherSeries)
otherSeries - the series to subtract from this one.IllegalArgumentException - if the other series is non-empty and the two series
differ in size.public final TimeSeries minus(@NonNull double[] otherSeries)
otherSeries - the series to subtract from this one.IllegalArgumentException - if the other series is non-empty and the two series
differ in size.public final TimeSeries slice(int start, int end)
start - the beginning index of the slice. The value at the index is included in the returned TimeSeries.end - the ending index of the slice. The value at the index is included in the returned TimeSeries.public final TimeSeries slice(@NonNull OffsetDateTime start, @NonNull OffsetDateTime end)
start - the beginning date and time of the slice. The value at the given date-time is included in the
returned time series.end - the ending date and time of the slice. The value at the given date-time is included in the returned
time series.public final TimeSeries timeSlice(int start, int end)
start - the beginning time index of the slice. The value at the time index is included in the returned
time series.end - the ending time index of the slice. The value at the time index is included in the returned
time series.public final void print()
public final List<Double> asList()
public final TimePeriod timePeriod()
public final OffsetDateTime startTime()
public final List<OffsetDateTime> observationTimes()
public final Map<OffsetDateTime,Integer> dateTimeIndex()
public final double[] asArray()
public double sum()
DataSetpublic double sumOfSquares()
DataSetsumOfSquares in interface DataSetpublic double mean()
DataSetpublic double median()
DataSetpublic int size()
DataSetpublic TimeSeries times(@NonNull DataSet otherData)
DataSetpublic TimeSeries plus(@NonNull DataSet otherData)
DataSetpublic double variance()
DataSetpublic double stdDeviation()
DataSetstdDeviation in interface DataSetpublic double covariance(DataSet otherData)
DataSetcovariance in interface DataSetotherData - the data to compute the covariance with.public double correlation(DataSet otherData)
DataSetcorrelation in interface DataSetotherData - the data to compute the correlation coefficient with.