This repository contains all code supplements and Mathematica derivations for the manuscript "Strategic Analysis of Dissent and Self-Censorship" developed by Joshua J. Daymude, Robert Axelrod, and Stephanie Forrest. Instructions for reproducing our results and experimenting with our simulations are below.
We use uv to manage Python environments.
After cloning this repository or downloading the latest release, install uv and then run the following to get all dependencies:
uv syncTo reproduce our data and figures, activate the Python virtual environment and navigate to the code/ directory:
source .venv/bin/activate
cd codeFigs. 1 and 2 show an individual's optimal action as a function of their desired dissent. They are produced with
python opt_action.pyThe corresponding analytical derivations (Eqs. 5–8) are verified in the Mathematica notebook opt_action.nb.
Fig. 3 visualizes the individual's optimal action as a function of the authority's parameters, differentiating between compliance, (partial or full) self-censorship, and defiance as different phases. It is produced with
python phase_diagram.pyFigs. 4–5 and S1–3 all show different results from the adaptive authority simulations. They are produced with
python hillclimbing.py -N 100000 -R 5000 -D 0.25 -B 2 -P uniform --seed 458734673
python hillclimbing.py -N 100000 -R 5000 -D 0.25 -B 8 -P uniform --seed 458734673
python hillclimbing.py -N 100000 -R 5000 -D 0.25 -B 1 -P proportional --seed 458734673
python hillclimbing.py -N 100000 -R 5000 -D 0.25 -B 3 -P proportional --seed 458734673
python hillclimbing.py --sweep -N 100000 -R 10000 -P uniform -A 1.0 -E 0.05 --seed 1978572166 --granularity 50 --trials 50 --threads 32
python hillclimbing.py --sweep -N 100000 -R 10000 -P proportional -A 1.0 -E 0.05 --seed 1978572166 --granularity 50 --trials 50 --threads 32Warning
The sweep experiments are time and memory intensive.
We ran on a a Linux machine with a 5.7 GHz Ryzen 9 7950X CPU (16 cores, 32 threads) and 64 GB of memory, parallelizing with --threads 32.
Modify this parameter as appropriate for your machine.
If you want to experiment with the adaptive authority simulations yourself (e.g., with different parameters), the following will print usage information:
python hillclimbing.py --helpIf you'd like to leave feedback, feel free to open a new issue. If you'd like to contribute, please submit your code via a pull request.