Error in ur.sadf(y, r0, type, lags, selectlags) : could not find function "ur.sadf"

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"))

Hi @mmv,
Welcome to the RStudio Community Forum.

This example code from the rtadfr package works fine for me once I corrected the following error:

#dateStampDf <- ts(cbind(testStat$testSeq, cvs$datestampCVs[,2]), start = c(1870,1), frequency = 12)
dateStampDf <- ts(cbind(test$testSeq, cvs$datestampCVs[,2]), start = c(1870,1), frequency = 12)

In your case, did you successfully install rtadfr from GitHub using?

# install.packages("devtools")
devtools::install_github("itamarcaspi/rtadfr")

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.