diff --git a/R/All-classes.R b/R/All-classes.R index f672f83..ec9d718 100644 --- a/R/All-classes.R +++ b/R/All-classes.R @@ -95,6 +95,7 @@ setClass("ur.pp", representation(y="vector", setClass("ur.df", representation(y="vector", model="character", lags="integer", + optilags='integer', cval="matrix", res="vector", teststat="matrix", diff --git a/R/ur-df.R b/R/ur-df.R index c28e8f9..baed9ba 100644 --- a/R/ur-df.R +++ b/R/ur-df.R @@ -36,7 +36,7 @@ ur.df <- function (y, type = c("none", "drift", "trend"), lags = 1, selectlags = result <- lm(z.diff ~ z.lag.1 + 1 + tt + z.diff.lag) critRes[i]<-AIC(result, k = switch(selectlags, "AIC" = 2, "BIC" = log(length(z.diff)))) } - lags<-which.min(critRes) + lags <- optimaxlags <- which.min(critRes) } z.diff.lag = x[, 2:lags] if (type == "none") { @@ -168,5 +168,6 @@ ur.df <- function (y, type = c("none", "drift", "trend"), lags = 1, selectlags = colnames(cvals) <- c("1pct", "5pct", "10pct") rownames(cvals) <- testnames - new("ur.df", y = y, model = type, cval=cvals, lags=lag, teststat = teststat, testreg=testreg, res=res, test.name="Augmented Dickey-Fuller Test") + new("ur.df", y = y, model = type, cval=cvals, lags=lag, optilags = optimaxlags, + teststat = teststat, testreg=testreg, res=res, test.name="Augmented Dickey-Fuller Test") } diff --git a/README.md b/README.md index c2fd2cc..7a53771 100644 --- a/README.md +++ b/README.md @@ -6,4 +6,7 @@ book [Analysis of Integrated and Cointegrated Time Series with R](http://www.springer.com/us/book/9780387759661). The package is hosted on [CRAN](https://CRAN.R-project.org/package=urca). +#### !! - Important Disclaimer - !! + +This package is a slightly modified version of the officially released ```urca``` package, which I modified for my own specific purposes. I modified the ```ur.df``` class and function so to store optimal lags and extract them for later use. This modification has not been tested outside the limited scope of my code and machine. Additional, minor modifications are planned but not high in priority.