library(fUnitRoots) library (readxl) UKHP <- read_excel("D:/Programming Guide/data/UKHP.xls", col_types = c("date","numeric")) #View(UKHP) head(UKHP) names (UKHP)[2] = "hp" head(UKHP) plot(ts(UKHP$hp,start=c(1991,1), frequency=12),main="Average house price",ylab="Dollars") #x11() # Levels adfTest(UKHP$hp, lags=10, type="c") # First difference: returns UKHP$dhp = c(NA, 100*diff(UKHP$hp)/UKHP$hp[1:nrow(UKHP)-1]) adfTest(UKHP$dhp, lags=10, type="c") #dev.off() par(mar = c(1,1,1,1)) # Changing area margins # Augmented Dickey-Fuller test adfgls = urersTest(UKHP$hp, type = "DF-GLS", model = "trend", lag.max = 10) graphics.off() adfgls@test$test@teststat adfgls@test$test@cval adfgls = urersTest(UKHP$hp, doplot=F, type = "DF-GLS", model = "trend", lag.max = 10) adfgls@test[["test"]]@cval adfgls@test[["test"]]@cval