com.cloudera.sparkts.stats

TimeSeriesStatisticalTests

object TimeSeriesStatisticalTests

Adapted from statsmodels: https://github.com/statsmodels/statsmodels/blob/master/statsmodels/tsa/stattools.py https://github.com/statsmodels/statsmodels/blob/master/statsmodels/tsa/adfvalues.py

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. TimeSeriesStatisticalTests
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. def adftest(ts: Vector, maxLag: Int, regression: String = "c"): (Double, Double)

    Augmented Dickey-Fuller test for a unit root in a univariate time series.

    Augmented Dickey-Fuller test for a unit root in a univariate time series.

    The null hypothesis is that the time series contains a unit root, implying that differencing is required to make it stationary. The alternative hypothesis is that the time series is stationary. Lower values of the test statistic imply lower p-values, and thus higher likelihood of rejecting the null hypothesis.

    ts

    The time series.

    returns

    A tuple containing the test statistic and p value.

  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. def bgtest(residuals: Vector, factors: Matrix, maxLag: Int): (Double, Double)

    Breusch-Godfrey test for serial correlation in a model The statistic asymptotically follows an X2 distribution with maxLag degrees of freedom, and provides a test for the null hypothesis of lack of serial correlation up to degree maxLag From http://en.wikipedia.org/wiki/Breusch%E2%80%93Godfrey_test: Given estimated residuals u_hat_t from an OLS model of the form y_t = a0 + a1 * x1_t + a2 * x2_t + ... + u_t We calculate an auxiliary regression of the form: u_hat_t = a0 + a1 * x1_t + a2 * x2_t + ... + p1 * u_hat_t-1 + p2 * u_hat_t-2 ... Our test statistic is then (# of obs - maxLag) * (R2 of the auxiliary regression)

    Breusch-Godfrey test for serial correlation in a model The statistic asymptotically follows an X2 distribution with maxLag degrees of freedom, and provides a test for the null hypothesis of lack of serial correlation up to degree maxLag From http://en.wikipedia.org/wiki/Breusch%E2%80%93Godfrey_test: Given estimated residuals u_hat_t from an OLS model of the form y_t = a0 + a1 * x1_t + a2 * x2_t + ... + u_t We calculate an auxiliary regression of the form: u_hat_t = a0 + a1 * x1_t + a2 * x2_t + ... + p1 * u_hat_t-1 + p2 * u_hat_t-2 ... Our test statistic is then (# of obs - maxLag) * (R2 of the auxiliary regression)

    returns

    The Breusch-Godfrey statistic and p value

  9. def bptest(residuals: Vector, factors: Matrix): (Double, Double)

    Breusch-Pagan test for heteroskedasticity in a model The statistic follows a X2 distribution with (# of regressors - 1) degrees of freedom and provides a test for a null hypothesis of homoskedasticity From http://en.wikipedia.org/wiki/Breusch%E2%80%93Pagan_test Given a vector of estimated residuals (u) from an OLS model, we create an auxiliary regression that models the squared residuals (u2) as a function of the original regressors (X) u2 = beta * X We construct our test statistic as (# of observations) * R2 of our auxiliary regression

    Breusch-Pagan test for heteroskedasticity in a model The statistic follows a X2 distribution with (# of regressors - 1) degrees of freedom and provides a test for a null hypothesis of homoskedasticity From http://en.wikipedia.org/wiki/Breusch%E2%80%93Pagan_test Given a vector of estimated residuals (u) from an OLS model, we create an auxiliary regression that models the squared residuals (u2) as a function of the original regressors (X) u2 = beta * X We construct our test statistic as (# of observations) * R2 of our auxiliary regression

    returns

    The Breusch-Pagan statistic and p value

  10. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  11. def dwtest(residuals: Vector): Double

    Durbin-Watson test for serial correlation.

    Durbin-Watson test for serial correlation.

    returns

    The Durbin-Watson test statistic. A value close to 0.0 gives evidence for positive serial correlation, a value close to 4.0 gives evidence for negative serial correlation, and a value close to 2.0 gives evidence for no serial correlation.

  12. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  13. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  14. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  15. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  16. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  17. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  18. def kpsstest(ts: Vector, method: String): (Double, Map[Double, Double])

    Performs the KPSS stationarity test (Kwiatkowski, Phillips, Schmidt and Shin).

    Performs the KPSS stationarity test (Kwiatkowski, Phillips, Schmidt and Shin). The null hypothesis corresponds to stationarity (level stationarity if method = "c", or trend stationarity if method = "ct"). If method = "c", a regression of the form ts_i = alpha + error_i is fit. If method = "ct", a regression of the form ts_i = alpha + beta * i + error_i. The test then performs a check for the variance of the errors. The null hypothesis of stationarity corresponds to a null hypothesis of variance = 0 for the errors. For more information please see pg 129 of http://faculty.washington .edu/ezivot/econ584/notes/unitroot.pdf. For the original paper on the test, please see http://www.deu.edu.tr/userweb/onder.hanedar/dosyalar/kpss.pdf. Finally, the current implementation follows R's tseries package implementation closely, which can be found at https://cran.r-project.org/web/packages/tseries/index.html

    ts

    time series to test for stationarity

    method

    "c" or "ct", short for fitting with a constant or a constant and a time trend

    returns

    the KPSS statistic and a map of critical values according to the method selected

  19. def lbtest(residuals: Vector, maxLag: Int): (Double, Double)

    Ljung-Box test for serial correlation in residuals up to lag maxLag.

    Ljung-Box test for serial correlation in residuals up to lag maxLag. The null hypothesis is that values are independently distributed up to the given lag. The alternate hypothesis is that serial correlation is present. The test statistic follows a Chi-Squared distribution with maxLag degrees of freedom. See https://en.wikipedia.org/wiki/Ljung%E2%80%93Box_test for more information.

    returns

    the test statistic and the p-value associated with it.

  20. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  21. final def notify(): Unit

    Definition Classes
    AnyRef
  22. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  23. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  24. def toString(): String

    Definition Classes
    AnyRef → Any
  25. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  26. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped