Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions R/All-classes.R
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 3 additions & 2 deletions R/ur-df.R
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down Expand Up @@ -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")
}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.