This repository contains the code and data accompanying the paper "Critical Values Robust to P-hacking", written by Adam McCloskey and Pascal Michaillat, and published in the Review of Economics and Statistics in April 2024.
The paper is available at https://pascalmichaillat.org/12/.
The results in the paper are obtained using MATLAB. The MATLAB code is located in the code
folder.
The main script, main.m
, orchestrates the production of the results in the paper. The script calibrates the model parameters and produces the 9 figures presented in the paper.
Before producing the figures, the main script calls the formatFigure.m
script to preformat figures and predefine figure properties. The figure properties are stored in variables in the MATLAB workspace.
The main script then produces the figures using a collection of scripts:
figure1A.m
- Produce figure 1Afigure1B.m
- Produce figure 1Bfigure2A.m
- Produce figure 2Afigure2B.m
- Produce figure 2Bfigure3A.m
- Produce figure 3Afigure3B.m
- Produce figure 3Bfigure4.m
- Produce figure 4A, figure 4B, and figure 4C
The scripts display the figures in MATLAB figure windows, save each figure as a PDF file, and save the underlying data as CSV files.
The figures produced by the code are saved as PDF files. The data used to generate the figures are saved as CSV files. All the files are located in the figures
folder, each corresponding to a specific figure in the paper:
figure1A.pdf
,figure1A.csv
- Figure 1Afigure1B.pdf
,figure1B.csv
- Figure 1Bfigure2A.pdf
,figure2A.csv
- Figure 2Afigure2B.pdf
,figure2B.csv
- Figure 2Bfigure3A.pdf
,figure3A.csv
- Figure 3Afigure3B.pdf
,figure3B.csv
- Figure 3Bfigure4A.pdf
,figure4A.csv
- Figure 4Afigure4B.pdf
,figure4B.csv
- Figure 4Bfigure4C.pdf
,figure4C.csv
- Figure 4C
-
Clone the repository to your local machine using Git or by downloading the ZIP file.
-
Open MATLAB and set the
code
folder as the current folder. -
To generate the figures presented in the paper, run the following command in the MATLAB command window:
run('main.m')
- By default, the main script overwrites the files in the
figures
folder. To preserve existing files, make a copy of the folder before running the script.
The results were obtained using MATLAB R2023b on macOS Sonoma (Apple silicon). Some scripts required the Statistics and Machine Learning Toolbox.
This repository is licensed under the MIT License.