urca

noetsi

Fortran must die
#1
I am really confused how this package works. This is for the ADF.

Code:
library(urca)
 data(Raotbl3)
 attach(Raotbl3)
 lc.df <- ur.df(y=lc, lags=3, type='trend')
 summary(lc.df)
According to what I have read elsewhere all the p values calculated in the out put are not to test the main hypothesis of the ADF. Instead you have to compare the critical values generated. "If the calculated test statistic is less (more negative) than the critical value, then the null hypothesis of non-stationary is rejected and no unit root is present."

There are three hypothesis the one I care about is non-stationarity
  • tau3 refers to the null hypothesis that there is a unit root.
  • phi3 refers to the null hypothesis that there is a unit root AND no-trend (without trend)
  • phi2 refers to the null hypothesis that there is a unit root without trend and without drift

The problem is that the output lists three critical values
Value of test-statistic is: -2.2389 3.7382 2.5972
I have no idea which you use. Unless the first one is for tau3, the next for phi3 and the last for phi2
 

noetsi

Fortran must die
#3
Value of test-statistic is: -2.2389 3.7382 2.5972

I think the first value is for tau, the second for phi2 and the third for phi3, but I have spend a lot of time looking with no success.

Code:
library(urca)
Warning message:
package ‘urca’ was built under R version 4.0.2
data(Raotbl3)
attach(Raotbl3)
lc.df <- ur.df(y=lc, lags=3, type='trend')
summary(lc.df)

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

Test regression trend


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

Residuals:
Min        1Q    Median        3Q       Max
-0.044714 -0.006525  0.000129  0.006225  0.045353

Coefficients:
Estimate Std. Error t value Pr(>|t|) 
(Intercept)  0.7976591  0.3547775   2.248   0.0270 *
z.lag.1     -0.0758706  0.0338880  -2.239   0.0277 *
tt           0.0004915  0.0002159   2.277   0.0252 *
z.diff.lag1 -0.1063957  0.1006744  -1.057   0.2934 
z.diff.lag2  0.2011373  0.1012373   1.987   0.0500 .
z.diff.lag3  0.2998586  0.1020548   2.938   0.0042 **
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.01307 on 89 degrees of freedom
Multiple R-squared:  0.1472,Adjusted R-squared:  0.09924
F-statistic: 3.071 on 5 and 89 DF,  p-value: 0.01325


Value of test-statistic is: -2.2389 3.7382 2.5972

Critical values for test statistics:
1pct  5pct 10pct
tau3 -4.04 -3.45 -3.15
phi2  6.50  4.88  4.16
phi3  8.73  6.49  5.47
 
Last edited:

noetsi

Fortran must die
#4
rather than do a hundred threads I am going to make this one on tests generally.

This is for the Breuch Godfrey test which works on residuals. The regression method I want to use ARDL has residuals, but no function I saw to get them. Does R have default code to pull residuals and given them a name that can be used by another package?

I don't understand what this means (I have no data for it which is why it is not coded. I am just trying to learn how to use this).

Code:
bgtest(formula, order = 1, order.by = NULL, type =c("Chisq", "F"), data = list(), fill = 0) # p2
They give these examples [which I don't understand in terms of the formula noted above]

Code:
## Perform Breusch-Godfrey test for first-order serial correlation:bgtest(y1 ~ x)
## or for fourth-order serial correlationbgtest(y1 ~ x, order = 4)/
I am not sure residuals are being used in the model statement or the raw data

How do you link it to residuals and how do you turn it into a formula? It starts on page 2.
https://cran.r-project.org/web/packages/lmtest/lmtest.pdf[/code]
 
Last edited: