Hi I'm trying to utilize the break command for breaking the loop when the p-value is less than 10 per cent using the urca package. But it does not break the loop, anyone that can help me?
library(urca) set.seed(1) a1 <- runif(100) lag.max <- function(object, n = 12){ matris <- matrix(NA, nrow = n) for(i in 1:n) { matris[i] <- ur.df(object, lags = i, type = "trend")@testreg$coefficients[i+3,4] if (i < 0.1) {break(i)} } list(matris = round(matris, 3)) } a2 <- lag.max(a1) /With regards Serdar [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.