Rtadfr
Testing for bubbles with R
Install / Use
/learn @itamarcaspi/RtadfrREADME
rtadfr <img src="man/figures/logo.png" align="right" width="15%" height="15%"/>
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
- Caspi, I. (2017). Rtadf: Testing for Bubbles with EViews. Journal of Statistical Software, 81(c01).
- Phillips, P. C. B., Wu, Y., & Yu, J. (2011). Explosive Behavior in the 1990s Nasdaq: When Did Exuberance Escalate Asset Values? International Economic Review, 201(1), 201--226.
- Phillips, P. C. B., Shi, S., & Yu, J. (2015). Testing for multiple bubbles: Historical episodes of exuberance and collapse in the S&P 500. International Economic Review, 56(4), 1034–1078.
License
This package is free and open source software, licensed under GPL-3.
Related Skills
node-connect
342.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
342.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.7kCommit, push, and open a PR
