Replication of Romano & Tirlea (2020), "Permutation Testing for Dependence in Time Series," Journal of Business & Economic Statistics.
The main output is analysis/permutation_test.Rmd, which implements and
demonstrates the studentized permutation test for autocorrelation — a test
that is exact under i.i.d. data and asymptotically valid for a broad class of
dependent time series, including all stationary ARMA processes.
R/permutation_test.R core function + unstudentized helper
analysis/permutation_test.Rmd demos, stopifnot checks, knits to PDF
tests/testthat/ 30 unit tests (testthat)
slides/ advisor presentation (Marp)
flake.nix, flake.lock pinned Nix dev shell (nixos-24.11, R 4.4.1)
renv.lock pinned R packages
.github/workflows/ci.yml CI: renv restore -> testthat -> knit -> PDF
The environment is reproduced at two layers:
- Nix flake (
flake.nix, pinned tonixos-24.11) provides R, pandoc, TeX Live, and system libraries. - renv (
renv.lock) pins the R package versions (rmarkdown, knitr, testthat).
nix develop # enters the Nix dev shell
R -e 'renv::restore()' # installs pinned R packages# Unit tests
R -e 'testthat::test_dir("tests/testthat")'
# Knit the analysis to PDF
R -e 'rmarkdown::render("analysis/permutation_test.Rmd")'A 10-slide advisor presentation lives in slides/:
slides.md— Marp source with speaker notesslides.pdf— pre-built PDF exportformula.png+formula.tex— the KaTeX-rendered equation block on slide 5glossary.md— term-by-term glossary of everything that appears in the deck
From inside the Nix dev shell:
# PDF export
nix run nixpkgs#marp-cli -- slides/advisor_slides.md \
--pdf --allow-local-files -o slides/slides.pdf
# One PNG per slide (useful for visual review)
nix run nixpkgs#marp-cli -- slides/advisor_slides.md \
--images png --allow-local-files -o slides/preview/slide.png
# HTML (for opening in a browser)
nix run nixpkgs#marp-cli -- slides/advisor_slides.md \
--html -o slides/slides.htmlTo regenerate formula.png from formula.tex:
cd slides
pdflatex formula.tex
convert -density 180 formula.pdf[0] -quality 95 \
-background white -alpha remove -trim +repage formula.pngRomano, J. P. & Tirlea, M. A. (2020). Permutation testing for dependence in time series. Journal of Business & Economic Statistics, 41(3), 1054–1064.