# SuanShu, a Java numerical and statistical library

## Class AugmentedDickeyFuller

• public class AugmentedDickeyFuller
extends HypothesisTest
The Augmented Dickey Fuller test tests whether a one-time differencing (d = 1) will make the time series stationary. That is, whether the series has a unit root. Cheung and Lai (1995) pointed out that the lag order does have some effect on the critical values, esp. when the sample size is small.

The R equivalent function is adf.test in package tseries.

• "S. E. Said and D. A. Dickey, "Testing for Unit Roots in Autoregressive-Moving Average Models of Unknown Order," Biometrika, vol. 71, no. 3, pp.599-607, 1984."
• "Yin-Wong Cheung, Kon S. Lai, "ESTIMATING FINITE SAMPLE CRITICAL VALUES FOR UNIT ROOT TESTS USING PURE RANDOM WALK PROCESSES," Journal of Time Series Analysis, vol. 16, issue 5, pp.493-498, 1995."
• ### Constructor Summary

Constructors
Constructor and Description
AugmentedDickeyFuller(double[] x)
Performs the Augmented Dickey-Fuller test to test for the existence of unit root.
AugmentedDickeyFuller(double[] x, TrendType type, int lagOrder, ADFDistribution dist)
Performs the Augmented Dickey-Fuller test to test for the existence of unit root.
• ### Method Summary

All Methods
Modifier and Type Method and Description
String getAlternativeHypothesis()
Get the description of the alternative hypothesis.
String getNullHypothesis()
Get a description of the null hypothesis.
double pValue()
Get the p-value for the test statistics.
double statistics()
Get the test statistics.
• ### Methods inherited from class com.numericalmethod.suanshu.stats.test.HypothesisTest

isNullRejected, nGroups, nObs, oneSidedPvalue
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Constructor Detail

• #### AugmentedDickeyFuller

public AugmentedDickeyFuller(double[] x,
TrendType type,
int lagOrder,
ADFDistribution dist)
Performs the Augmented Dickey-Fuller test to test for the existence of unit root.
Parameters:
x - a time series
type - the trend type
lagOrder - the lag order; when lagOrder = 0, we perform the original Dickey-Fuller test.
dist - the ADF distribution to use; in general, the correct ADF distribution depends on the trend type and lag order; to improve accuracy, the user may generate and use a customized ADF distribution; null for the default
• #### AugmentedDickeyFuller

public AugmentedDickeyFuller(double[] x)
Performs the Augmented Dickey-Fuller test to test for the existence of unit root. Lag order is automatically selected as in R.
 nLag = (int) Math.pow((series.length - 1, 1.0 / 3.0)); 
This corresponds to the suggested upper bound on the rate.
Parameters:
x - a time series
• ### Method Detail

• #### getNullHypothesis

public String getNullHypothesis()
Description copied from class: HypothesisTest
Get a description of the null hypothesis.
Specified by:
getNullHypothesis in class HypothesisTest
Returns:
the null hypothesis description
Wikipedia: Null hypothesis
• #### getAlternativeHypothesis

public String getAlternativeHypothesis()
Description copied from class: HypothesisTest
Get the description of the alternative hypothesis.
Specified by:
getAlternativeHypothesis in class HypothesisTest
Returns:
the alternative hypothesis description
Wikipedia: Alternative hypothesis
• #### statistics

public double statistics()
Description copied from class: HypothesisTest
Get the test statistics.
Specified by:
statistics in class HypothesisTest
Returns:
the test statistics
Wikipedia: Test statistic
• #### pValue

public double pValue()
Description copied from class: HypothesisTest
Get the p-value for the test statistics.
Specified by:
pValue in class HypothesisTest
Returns:
the p-value