Showing posts with label Stock Unit Root Test. Show all posts
Showing posts with label Stock Unit Root Test. Show all posts

## How to find Elliot, Rothenberg, and Stock Unit Root Test

> data(nporg)
> gnp <- na.omit(nporg[, "gnp.r"])
> ers.gnp <- ur.ers(gnp, type="DF-GLS", model="const", lag.max=4)
> summary(ers.gnp)

###############################################
# Elliot, Rothenberg and Stock Unit Root Test #
###############################################

Test of type DF-GLS
detrending of series with intercept

Call:
lm(formula = dfgls.form, data = data.dfgls)

Residuals:
Min      1Q  Median      3Q     Max
-39.767  -6.011   4.775  14.896  31.454

Coefficients:
Estimate Std. Error t value
yd.lag        0.02559    0.01793   1.427
yd.diff.lag1  0.45630    0.14668   3.111
yd.diff.lag2  0.06223    0.15879   0.392
yd.diff.lag3 -0.02445    0.15965  -0.153
yd.diff.lag4 -0.10768    0.15110  -0.713
Pr(>|t|)
yd.lag        0.15962
yd.diff.lag1  0.00303 **
yd.diff.lag2  0.69672
yd.diff.lag3  0.87886
yd.diff.lag4  0.47925
---
Signif. codes:
0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 16.49 on 52 degrees of freedom
Multiple R-squared:  0.3825, Adjusted R-squared:  0.3231
F-statistic: 6.442 on 5 and 52 DF,  p-value: 9.956e-05

Value of test-statistic is: 1.4268

Critical values of DF-GLS are:
1pct  5pct 10pct
critical values -2.6 -1.95 -1.62
> sjd <- denmark[, c("LRM", "LRY", "IBO", "IDE")]
> sjd.vecm <- ca.jo(sjd, ecdet = "const", type="eigen", K=2, spec="longrun",
+                   season=4)
> HD1 <- matrix(c(1, -1, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 1), c(5,3))
> DA <- matrix(c(1,0,0,0, 0, 1, 0, 0, 0, 0, 0, 1), c(4,3))
> summary(ablrtest(sjd.vecm, H=HD1, A=DA, r=1))

######################

### # Johansen-Procedure #

######################

Estimation and testing under linear restrictions on alpha and beta

The VECM has been estimated subject to:
beta=H*phi and/or alpha=A*psi

[,1] [,2] [,3]
[1,]    1    0    0
[2,]   -1    0    0
[3,]    0    1    0
[4,]    0   -1    0
[5,]    0    0    1

[,1] [,2] [,3]
[1,]    1    0    0
[2,]    0    1    0
[3,]    0    0    0
[4,]    0    0    1

Eigenvalues of restricted VAR (lambda):
[1] 0.4100 0.0090 0.0053

The value of the likelihood ratio test statistic:
2.13 distributed as chi square with 2 df.
The p-value of the test statistic is: 0.35

Eigenvectors, normalised to first column
of the restricted VAR:

[,1]
[1,]  1.0000
[2,] -1.0000
[3,]  5.9508
[4,] -5.9508
[5,] -6.2162

Weights W of the restricted VAR:

[,1]
[1,] -0.1519
[2,]  0.0992
[3,]  0.0000
[4,]  0.0288