Code for reproducing the results in "The Split Senate" preprint.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
R (>= 3.6.1) or Python (>= 3.6) is necessary for analysis:
R can be downloaded here
The RStudio IDE can be downloaded here
For R Analysis:
-
Clone github repo
-
Move to main scripts
cd CP_2021/R/scripts
- Run gendata.R
rscript gendata.R
- This will install all necessary packages, create the annotated dataset for analysis, and set the working directory.
For Python Analysis: Replicates analysis in R using the SplitsPy package [1].
-
Clone github repo
-
Install Fisher's Exact Test in Python
pip install FisherExact
If an error occurs, may require pip install future
or installation of gfortran
(see here).
- Move to main scripts
cd CP_2021/Python
For R Code:
-
senateVotes.R
- Code to generate splits graphs for the 116th Senate
- Analysis of apparent 'coalitions' of Democratic Senators
- Statistical analysis of vote contribution to coalition splits
-
splitDistCorr.R
- Concordance and correlation of split weight distances and L1 input distances for the 116th Senate
-
senateOverTime.R
- Analysis of agreement distributions ('center' distances) across Senates from the last 30 years
-
missingSenators.R
- Creation of distance matrices for splits graphs of senators not present for all votes in the 116th Senate
-
exampleforFig1.R
- Code to generate example splits graph in Figure 1
All scripts utilize functions from distFuncs.R
For Python Code:
- run_voteAnalysis.py
- Runs analysis analagous to senateVotes.R and senateOverTime.R
- Generate circular split-system, phylogenetic outline of system, and NEXUS files for SplitsTree viewing
- Analysis of apparent 'coalitions', statistical analysis of vote contributions to splits, and analysis of agreement distributions over time.
- Tara Chari
[1] Daniel H. Huson, Caner Bagci, Banu Cetinkaya and David Bryant. Phylogenetic context and the use of phylogenetic outlines. Manuscript in preparation (2021)