Dickey-Fuller?
Spencer Graves
spencer.graves at pdf.com
Tue Dec 4 04:25:18 CET 2007
Hello, Kurt, Bernhard, Diethelm, and Javier:
Can you help me find an R match for the S-Plus Finmetrics
'unitroot' results below for the Augmented Dickey-Fuller test? This
will become part of the "FinTS" package companion to Tsay (2005)
Analysis of Financial Time Series, 2nd ed. (Wiley). This example is
discussed on pp. 69-71 of Tsay (2005). I'm writing to you, because you
are the (primary) maintainers for packages with Augmented Dickey-Fuller
functions, and I've so far been unable to replicate the 'unitroot'
results. Below please find my best guess so far of how I should use
your functions, none of which produce answers sufficiently close to
'unitroot' to convince me I knew what I was doing.
Any help you can give me will be greatly appreciated.
Spencer Graves
##################################
##
## 1. Get the data
##
FinTS.url <- "http://gsbwww.uchicago.edu/fac/ruey.tsay/teaching/fts2/"
gdpFile <- paste(FinTS.url, "q-gdp4703.txt", sep="")
gdp. <- read.table(gdpFile)
gdp <- log(gdp.[, 3])
##
## 2. Try to replicate the analysis
##
library(tseries)
(adf.e.gdp <- adf.test(gdp, alternative="explosive", k=10))
#Dickey-Fuller = -0.9741, Lag order = 10, p-value = 0.05918
library(urca)
summary(ur.d.gdp <- ur.df(gdp, lags=10))
# statistic = 2.262, between 1 and 5% levels
library(fUnitRoots)
(fadf.c.gdp <- adfTest(gdp, lags=10))
# ADF = 2.262, p-value = 0.99
library(uroot)
(ADF.d.l.gdp <- ADF.test(gdp, c(1,0,0),
selectlags=list(mode="signif", Pmax=10)))
#Error in switch(selectlags[[1]], aic = selP <- selPabic(lmdet = lmdf,
# argument is missing, with no default
##################################
Ruey S. Tsay ,(Faculty) wrote:
> Hi Spencer:
>
> GDP = ln(x), where x is the column three of the data file "q-gdp4703.txt".
> The test result may depend onthe way people treat the order and constant term.
> If you print out more information from R, you may be able to find the difference.
>
> Ruey
>
>
> Below is the output I got from S-Plus. [I did it this morning.]
>
>> x=read.table("q-gdp4703.txt")
>> gdp=log(x[,3])
>>
>
>
>> m=unitroot(gdp,trend='c',method='adf',lags=10)
>> summary(m)
>>
>
> Test for Unit Root: Augmented DF Test
>
> Null Hypothesis: there is a unit root
> Type of Test: t-test
> Test Statistic: -1.131
> P-value: 0.7038
>
> Coefficients:
> Value Std. Error t value Pr(>|t|)
> lag1 -0.0006 0.0006 -1.1306 0.2595
> lag2 0.3797 0.0679 5.5946 0.0000
> lag3 0.1866 0.0719 2.5940 0.0102
> lag4 -0.1056 0.0730 -1.4474 0.1493
> lag5 0.0287 0.0728 0.3938 0.6942
> lag6 -0.1535 0.0718 -2.1376 0.0337
> lag7 0.0790 0.0725 1.0896 0.2772
> lag8 0.0685 0.0718 0.9550 0.3407
> lag9 -0.1006 0.0709 -1.4187 0.1575
> lag10 0.1798 0.0656 2.7405 0.0067
> constant 0.0123 0.0048 2.5654 0.0110
>
> Regression Diagnostics:
>
> R-Squared 0.2831
> Adjusted R-Squared 0.2485
> Durbin-Watson Stat 2.0265
>
> Residual standard error: 0.009498 on 214 degrees of freedom
> F-statistic: 8.175 on 10 and 207 degrees of freedom, the p-value is 4.078e-11
>
>
More information about the Rmetrics-core
mailing list