I run this code in RStudio and I get the following error:
"Error in ur.sadf(y, r0, type, lags, selectlags) : could not find function "ur.sadf""
Can you help me?
Code:
library(rtadfr)
library(urca)
# SADF test
set.seed(1203)
data(snp)
obs <- nrow(snp)
r0 <- round(obs*(0.01 + 1.8 / sqrt(obs)))
test <- rtadf(snp[,1], r0, test = "sadf")
cvs <- rtadfSimPar(obs, nrep = 1000, r0, test = "sadf")
testDf <- list("test statistic" = test$testStat, "critical values" = cvs$testCVs)
print(testDf)
dateStampDf <- ts(cbind(testStat$testSeq, cvs$datestampCVs[,2]), start = c(1870,1), frequency = 12)
ts.plot(dateStampDf, plot.type = "single", col=c("blue", "red"))