Package smile.timeseries
Interface TimeSeries
public interface TimeSeries
Time series utility functions.
-
Method Summary
Modifier and TypeMethodDescriptionstatic double
acf
(double[] x, int lag) Autocorrelation function.static double
cov
(double[] x, int lag) Autocovariance function.static double[]
diff
(double[] x, int lag) Returns the first-differencing of time series.static double[][]
diff
(double[] x, int lag, int differences) Returns the differencing of time series.static double
pacf
(double[] x, int lag) Partial autocorrelation function.
-
Method Details
-
diff
static double[] diff(double[] x, int lag) Returns the first-differencing of time series. First-differencing a time series will remove a linear trend (i.e., differences=1). In addition, first-differencing a time series at a lag equal to the period will remove a seasonal trend (e.g., set lag=12 for monthly data).- Parameters:
x
- time serieslag
- the lag at which to difference- Returns:
- the first-differencing of time series.
-
diff
static double[][] diff(double[] x, int lag, int differences) Returns the differencing of time series. First-differencing a time series will remove a linear trend (i.e., differences=1); twice-differencing will remove a quadratic trend (i.e., differences=2). In addition, first-differencing a time series at a lag equal to the period will remove a seasonal trend (e.g., set lag=12 for monthly data).- Parameters:
x
- time serieslag
- the lag at which to differencedifferences
- the order of differencing- Returns:
- the differencing of time series.
-
cov
static double cov(double[] x, int lag) Autocovariance function.- Parameters:
x
- time series.lag
- the lag.- Returns:
- autocovariance.
-
acf
static double acf(double[] x, int lag) Autocorrelation function.- Parameters:
x
- time series.lag
- the lag.- Returns:
- autocorrelation.
-
pacf
static double pacf(double[] x, int lag) Partial autocorrelation function. The partial autocorrelation function (PACF) gives the partial correlation of a stationary time series with its own lagged values, regressed the values of the time series at all shorter lags.- Parameters:
x
- time series.lag
- the lag.- Returns:
- partial autocorrelation.
-