# Replication Materials

These data and code replicate the tables and figures for "Voting for Democracy? Testing Political-Cultural Constraints on Democratic Backsliding."

## Data

The `data` folder contains five input datasets:

- `democ_cultures_us.csv`: United States survey data.
- `democ_cultures_sk.csv`: South Korea survey data.
- `democ_cultures_pl.csv`: Poland survey data.
- `democ_cultures_pool.csv`: pooled survey data combining the three country samples.
- `population_benchmark_margins_v3.csv`: population benchmark margins used for sample-comparison tables.

## Supporting documents

The file `figure_table_mapping.csv` lists which output file corresponds to each table and figure in the paper and supplementary materials.

The survey questionnaire and preanalysis plan are included. 

## Code

The `scripts` folder contains the R scripts used to construct measures, reshape the conjoint data, estimate the main and supplementary models, and save tables and figures to the `outputs` folder.

- `dem cultures code 0 run all.R` installs/checks required R packages and runs the full replication workflow.
- `dem cultures code 1 measures v2.R` prepares the main analytic datasets and political-culture measures.
- `dem cultures code 2 conjoint v2.R` prepares conjoint variables and marginal-mean outputs.
- `dem cultures code 3*` scripts estimate ATME models and related leave-one-out and faceted analyses.
- `dem cultures code 4*` scripts estimate linear probability models and leave-one-out variants.
- `dem cultures code 5 nonparam v2.R` produces nonparametric descriptive analyses.
- `dem cultures code 7 background v3.R` produces background, reliability, measurement, and sample-comparison outputs.
- `dem cultures code 9*` scripts estimate logit predicted probabilities and first differences.
- `dem cultures code 10 add analyses v3.R` produces additional robustness and revision analyses.

## Running The Replication

Run `scripts/dem cultures code 0 run all.R`. This is the master script: it sets the project root, creates needed folders, installs/checks packages, and then runs the remaining scripts in order.
