Skip to content

max-miller1204/Autocorrelation-Replication

Repository files navigation

Autocorrelation Replication

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.

Repository layout

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

Environment

The environment is reproduced at two layers:

  • Nix flake (flake.nix, pinned to nixos-24.11) provides R, pandoc, TeX Live, and system libraries.
  • renv (renv.lock) pins the R package versions (rmarkdown, knitr, testthat).

First-time setup

nix develop                            # enters the Nix dev shell
R -e 'renv::restore()'                 # installs pinned R packages

Running

# Unit tests
R -e 'testthat::test_dir("tests/testthat")'

# Knit the analysis to PDF
R -e 'rmarkdown::render("analysis/permutation_test.Rmd")'

Slides

A 10-slide advisor presentation lives in slides/:

  • slides.md — Marp source with speaker notes
  • slides.pdf — pre-built PDF export
  • formula.png + formula.tex — the KaTeX-rendered equation block on slide 5
  • glossary.md — term-by-term glossary of everything that appears in the deck

Rebuilding the slides

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.html

To 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.png

Reference

Romano, J. P. & Tirlea, M. A. (2020). Permutation testing for dependence in time series. Journal of Business & Economic Statistics, 41(3), 1054–1064.

About

A replication of the analysis and findings from: Romano, J. P., & Tirlea, M. A. (2020). Permutation testing for dependence in time series.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors