[R] Problems with Unit Root testing using ur.df function

Matthieu Stigler stigler3 at etu.unige.ch
Fri Apr 4 14:05:51 CEST 2008


Matthieu Stigler a écrit :
> Hi All,
>
> I'm new to R and am trying to run a unit root test on the vector "y" 
> (a time
> series of inflation (i.e. changes in the Consumer Price Index quarter on
> quarter)).
> I've run the Augmented-Dickey-Fuller Test below (R's URCA package). It 
> gives
> me an error that it cannot find the function ur.df unless I comment 
> out the
> third last line of code (see below).
>
Note that thes ADf test is the best known and maybe most used unit root 
test, but sure not the most powerfull. Maddala and Kim (Unit root, 
cointegration a nd structural break) criticize it and recommend use of 
other tests, maybe the ERS aslo avalaible in urca
> I try to call the function via the following:
>
> test <- ur.df(y, type = "none", lags = 1)
>
> Am I doing this correctly?
>
YES
>
> When I then type in
>
> test()
>
> it comes back with
>
> Error: could not find function "test"
>
>
If you put parentheses, R thinks it is a function... just let test, or, 
equal, print(test)
> When I type in
> a <- summary(test)
>
> It comes back with
>> / a
> / Length Class Mode
> 1 character character
>
this is strange... you should have the usual summary...
I have on my machine
library(urca)
test2<-ur.df(nottem, type="none", lags=1)
summary(test2)

###############################################
# Augmented Dickey-Fuller Test Unit Root Test #
###############################################

Test regression none


Call:
lm(formula = z.diff ~ z.lag.1 - 1 + z.diff.lag)

Residuals:
Min 1Q Median 3Q Max
-12.7479 -2.8589 0.5654 3.7597 12.7562

Coefficients:
Estimate Std. Error t value Pr(>|t|)
z.lag.1 -0.008473 0.006089 -1.392 0.165
z.diff.lag 0.461745 0.058185 7.936 8.41e-14 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 4.676 on 236 degrees of freedom
Multiple R-squared: 0.213, Adjusted R-squared: 0.2063
F-statistic: 31.93 on 2 and 236 DF, p-value: 5.316e-13


Value of test-statistic is: -1.3915

Critical values for test statistics:
1pct 5pct 10pct
tau1 -2.58 -1.95 -1.62


dont' you have it? What is this / a?
> I just want it to provide summary stats of the unit root test (ADF or 
> PP) on
> the vector y.
>
> Thank you for your help,
> Leyla
>



More information about the R-help mailing list