Skip to content

metricshilab/panel-lp-replication

Repository files navigation

Replication: Panel Local Projection

This repository hosts a replication package for

The replication code is written in R.

Repository Structure and Replication Overview

  • applications/: Empirical applications. Contains the data files (empirical_*.csv), the main R routine (LP_panel_all.r). The Jupyter notebook replication.ipynb reproduces the results and figures of all the four empirical application in the paper (Running time: <=30 seconds).
  • simulations/: Monte Carlo simulations for the main text (Figures 1-3). See simulations/README.md for details about the scripts and figures.
  • simulations_appendix/: Simulation code for Appendix C (Figures C1-C12). The workflow is explained in simulations_appendix/readme.md for instructions.

In short:

  • Empirical results -> applications/
  • Main-text simulations -> simulations/
  • Appendix simulations -> simulations_appendix/

Packages

Docker Environment

DockerHub

An R environment is provided at DockerHub. It can run in Github's codespaces directly (Install a Jupyter Kernel extension in the remote vscode if popped up.)

Local Environment

To run the R notebook in a fully reproducible environment, build the Docker image from the repository root:

docker build -t plp .

Launch the container, exposing JupyterLab on port 8888 and mounting the repository so that changes persist:

docker run --rm -it -p 8888:8888 \
  -e JUPYTER_TOKEN=panel-lp \
  -v ${PWD}:/home/jovyan/work \
  plp

The container will print a URL containing the token (or the JUPYTER_TOKEN you supplied). Open that link in a browser to access JupyterLab, then open applications/replication.ipynb. All required R packages (ggplot2, reshape2, ggpubr) are pre-installed in the image.

Documentation Site

The GitHub Pages site in docs/ can be previewed locally with Jekyll:

cd docs
bundle install
bundle exec jekyll serve --livereload

This requires Ruby (>=3.0 recommended) and Bundler. Once the server is running, open the URL printed in the terminal (typically http://127.0.0.1:4000) to browse the site.

Contributors

License

This work is licensed under the MIT License.