Library: | times |
See also: | kpss |
Quantlet: | adf | |
Description: | calculates the test statistic 'tau' for a unit root in a time series according to the Augmented Dickey-Fuller test. Nonstandard critical values are given according to MacKinnon's response surface. t-values and corresponding probability-values are given for the coefficients of the lagged differences. Moreover, the residuals of the regression are calculated. |
Usage: | {tau,diagnostics} = adf(y,p{,constant,trend}) | |
Input: | ||
y | T x 1 vector, times series | |
p | scalar, number of lagged differences that will be included in the regression | |
constant | optional string, a constant is included in the regression if constant = "constant" | |
trend | optional string, a linear trend is included in the regression if trend = "trend" | |
Output: | ||
tau | scalar, value of the test statistic for a unit root | |
diagnostics | list that contains three regression diagnostics. Vector "critvalues" contains 1%, 5%, and 10% critical values for the test statistic tau. The matrix "tvalueslags" contains t-values for the estimated coefficients of the lagged differences (first column) and the corresponding probability-values. If no lags are included (that is, p = 0), "tvalueslags" consists of zeros. The "residuals" of the regression can be used for further analysis and should appear to be white noise. |
(1-B)y = c1 + c2*trend + tau*By + a1(1-B)By + ... + ap(1-B)B^py + u
Here, c1 is a constant, c2 is a trend, ai are the coefficients for lagged differences (i = 1...p) and u is white noise. If the series is nonstationary, then tau = 0. The distribution of the test statistic for tau = 0 is nonstandard and simulated critical values are used. The critical values depend on whether a constant or a trend is included and on the number of observations that are used for the regression. Critical values are calculated according to the response surface given in MacKinnon (1991). Rejection of a unit root means that tau = 0 is rejected according to these critical values. Specify a constant or a constant and a trend if this is plausible under the null and the alternative hypothesis.
library("times") ; loads the quantlets from times library lndax = log(read("dax.dat")) ; log of monthly DAX 1979:1-2000:10 {tau,cv} = adf(lndax,4,"constant","trend") ; constant and trend are included because the alternative is an ARMA process with trend tau ; test statistic for a unit root cv.critvalues ; nonstandard critical values for tau cv.tvalueslags ; t- and probability-values for the estimated coefficients of lagged differences qlb = boxlj(cv.residuals,5) ; calculates the acf and the Box-Lung statistics with probability-values for the first five lags of the residuals qlb ; renders the calculations of boxlj
Contents of tau [1,] -2.3643 Contents of critvalues [1,] -3.997 [2,] -3.4286 [3,] -3.1374 Contents of tvalueslags [1,] 0.83643 0.4029 [2,] 0.78346 0.43334 [3,] -0.25112 0.80172 [4,] 0.53469 0.59285 Contents of qlb [1,] 0.00074361 0.00014377 0.99043 [2,] 0.0030101 0.0025089 0.99875 [3,] 0.0020374 0.0035967 0.99994 [4,] 0.0039383 0.0076774 0.99999 [5,] -0.047818 0.61164 0.98746 Even at the 10% level the critical value is -3.1374 and we can not reject the null hypothesis that the log DAX series has a unit root. The number of included lagged differences may be smaller to remove any serial correlation in the residuals. Four lags are chosen to show the output for a regression with lagged differences.