README.md

rtadfr

Travis-CI Build Status lifecycle

The R package rtadfr (Right Tailed ADF Tests with R) facilitates the Phillips, Wu, and Yu (2011) and Phillips, Shi, and Yu (2015) right tailed unit root tests for exuberance behavior. This package is planned to be the R equivalent of the rtadf EViews add-in (Caspi, 2017).

Installation

You can install the development version from Github

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

Usage

library(rtadfr)

# SADF test

set.seed(1203)  # for replicability
data(snp)  # load S&P 500 data
obs <- nrow(snp)  # Sample size
r0  <- round(obs*(0.01 + 1.8 / sqrt(obs)))  # Minimal window size

test <- rtadf(snp[,1], r0, test = "sadf")  # estimate test statistic and date-stamping sequence
cvs  <- rtadfSimPar(obs, nrep = 1000, r0, test = "sadf")  # simulate critical values and date-stamping threshold

testDf <- list("test statistic" = test$testStat, "critical values" = cvs$testCVs)  # test results

print(testDf)  

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

ts.plot(dateStampDf, plot.type = "single", col=c("blue", "red"))

References

License

This package is free and open source software, licensed under GPL-3.



itamarcaspi/rtadfr documentation built on Oct. 20, 2019, 7:47 a.m.