Namespace Statistics¶

namespace
statistics
¶ Functions

af::array
covariance
(af::array tss, bool unbiased = true)¶ Returns the covariance matrix of the time series contained in tss.
 Return
 af::array The covariance matrix of the time series.
 Parameters
tss
: Expects an input array whose dimension zero is the length of the time series (all the same) and dimension one indicates the number of time series.unbiased
: Determines whether it divides by n  1 (if false) or n (if true).

af::array
kurtosis
(af::array tss)¶ Returns the kurtosis of tss (calculated with the adjusted FisherPearson standardized moment coefficient G2).
 Return
 af::array The kurtosis of tss.
 Parameters
tss
: Expects an input array whose dimension zero is the length of the time series (all the same) and dimension one indicates the number of time series.

af::array
moment
(af::array tss, int k)¶ Returns the kth moment of the given time series.
 Return
 af::array The kth moment of the given time series.
 Parameters
tss
: Expects an input array whose dimension zero is the length of the time series (all the same) and dimension one indicates the number of time series.k
: The specific moment to be calculated.

af::array
ljungBox
(af::array tss, long lags)¶ The Ljung–Box test checks that data within the time series are independently distributed (i.e. the correlations in the population from which the sample is taken are 0, so that any observed correlations in the data result from randomness of the sampling process). Data are no independently distributed, if they exhibit serial correlation.
The test statistic is:
\[ Q = n\left(n+2\right)\sum_{k=1}^h\frac{\hat{\rho}^2_k}{nk} \]where ‘’n’’ is the sample size, \(\hat{\rho}k \) is the sample autocorrelation at lag ‘’k’‘, and ‘’h’’ is the number of lags being tested. Under \( H_0 \) the statistic Q follows a \(\chi^2{(h)} \). For significance level \(\alpha\), the \(critical region\) for rejection of the hypothesis of randomness is:
\[ Q > \chi_{1\alpha,h}^2 \]where \( \chi_{1\alpha,h}^2 \) is the \(\alpha\)quantile of the chisquared distribution with ‘’h’’ degrees of freedom.
[1] G. M. Ljung G. E. P. Box (1978). On a measure of lack of fit in time series models. Biometrika, Volume 65, Issue 2, 1 August 1978, Pages 297–303.
 Return
 af::array LjungBox statistic test.
 Parameters
tss
: Expects an input array whose dimension zero is the length of the time series (all the same) and dimension one indicates the number of time series.lags
: Number of lags being tested.

af::array
quantile
(af::array tss, af::array q, float precision = 100000000)¶ Returns values at the given quantile.
 Return
 af::array Values at the given quantile.
 Parameters
tss
: Expects an input array whose dimension zero is the length of the time series (all the same) and dimension one indicates the number of time series. NOTE: the time series should be sorted.q
: Percentile(s) at which to extract score(s). One or many.precision
: Number of decimals expected.

af::array
quantilesCut
(af::array tss, float quantiles, float precision = 0.00000001)¶ Discretizes the time series into equalsized buckets based on sample quantiles.
 Return
 af::array Matrix with the categories, one category per row, the start of the category in the first column and the end in the second category.
 Parameters
tss
: Expects an input array whose dimension zero is the length of the time series (all the same) and dimension one indicates the number of time series. NOTE: the time series should be sorted.quantiles
: Number of quantiles to extract. From 0 to 1, step 1/quantiles.precision
: Number of decimals expected.

af::array
sampleStdev
(af::array tss)¶ Estimates standard deviation based on a sample. The standard deviation is calculated using the “n1” method.
 Return
 af::array The sample standard deviation.
 Parameters
tss
: Expects an input array whose dimension zero is the length of the time series (all the same) and dimension one indicates the number of time series.

af::array
skewness
(af::array tss)¶ Calculates the sample skewness of tss (calculated with the adjusted FisherPearson standardized moment coefficient G1).
 Return
 af::array Array containing the skewness of each time series in tss.
 Parameters
tss
: Expects an input array whose dimension zero is the length of the time series (all the same) and dimension one indicates the number of time series.

af::array