{"id":24111891,"url":"https://github.com/andybega/cmps-itt","last_synced_at":"2026-05-11T08:59:34.569Z","repository":{"id":144784568,"uuid":"208994605","full_name":"andybega/cmps-itt","owner":"andybega","description":"Replication materials","archived":false,"fork":false,"pushed_at":"2019-10-21T07:23:41.000Z","size":56829,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-11T02:53:14.049Z","etag":null,"topics":["cmps","human-rights","itt","peer-reviewed-article","replication","specification-plots","torture"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andybega.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-17T08:03:08.000Z","updated_at":"2024-10-14T04:27:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"1bcebae0-7b67-4433-b452-e11b9b39ac9d","html_url":"https://github.com/andybega/cmps-itt","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andybega%2Fcmps-itt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andybega%2Fcmps-itt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andybega%2Fcmps-itt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andybega%2Fcmps-itt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andybega","download_url":"https://codeload.github.com/andybega/cmps-itt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241117321,"owners_count":19912521,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cmps","human-rights","itt","peer-reviewed-article","replication","specification-plots","torture"],"created_at":"2025-01-11T02:52:17.524Z","updated_at":"2026-05-11T08:59:34.537Z","avatar_url":"https://github.com/andybega.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n```{r setup, include=FALSE}\nknitr::opts_chunk$set(echo = TRUE)\n```\n\n# Examining Repressive and Oppressive State Violence using the Ill-Treatement Contents and Torture Data\n\nThis repo contains replication materials for:\n\nBeger, Andreas and Daniel W. Hill, Jr., 2019, \"Examining Repressive and Oppressive State Violence using the Ill-Treatement Contents and Torture Data\", _Conflict Managament and Peace Science_. \n\nThe journal article link is at https://doi.org/10.1177/0738894219882352, and a [pre-print PDF](https://github.com/andybega/cmps-itt/blob/master/preprint.pdf) is also included in this repo.  \n\n```bibtex\n@article{beger2019examining,\n  author = {Andreas Beger and Daniel W.\\ Hill, Jr.\\},\n  title = {Examining Repressive and Oppressive State Violence using the Ill-Treatement Contents and Torture Data},\n  year = 2019,\n  journal = {Conflict Management and Peace Science},\n  volume = {},\n  number = {},\n  doi = {https://doi.org/10.1177/0738894219882352}\n}\n```\n\n(Note to my future self: the private [isa-2018](https://github.com/andybega/isa-2018) repo contains the original source material, including the tagged ISA 2018 version.)\n\n## Setup\n\nTo see and installed the R packages needed for replication, see the `setup.R` script. It preferentially uses the **checkpoint** packages to install the required packages using the 2019-08-15 CRAN snapshot. This ensures the package versions match those we used when we last updated the results.\n\nIt will also check for and if needed create output directories according to the structure shown below, although if you got this code from GitHub they should already be in place. \n\n### Working directory\n\nAll scripts are setup with the assumption that the working directory is set to the `cmps-itt` folder. \n\n## Code\n\nThe R scripts in the `R/` folder replicate the figures and tables in the main paper and supplemental appendix. The `R/functions.R` file contains helper functions used in some of the other scripts, otherwise all the other files can be run in the order they sort alphabetically. \n\nFiles that start with `si`...pertain to the SI. All other files are related to the main article. \n\nAll output generated by the scripts will be saved in the `output/` folder and sub-folders. It should have the following structure:\n\n```\n- output/\n  - figures/\n  - figures-robustness/\n  - models/\n  - tables/\n```\n\nTraining the XGBoost model (`2-xgboost.R`) and the SI expanded model set (`si1-estimate-all-models.R`) takes a while. We have included the trained XGBoost model in `output/mdl-xgboost-orig.rds` with `output/xgboost-fit-orig.csv` and thus it is possible to replicate the main results without re-training it. (Note that if you do re-run `2-xgboost.R`, you need to change references to the \"-orig\" files to versions without those suffixes in some of the scripts.) \n\nThere are 1,008 models in the SI. These are not included, but estimating them does not take quite as long as training the XGBoost model. \n\n### Script runtimes \n\nSome of the scripts take longer to run. One a 2016 MacBook Pro:\n\n- `1-estimate-core-models.R`: about 10 minutes, mostly for the cross-validation\n- `xgboost.R`:\n- `si1-estimate-all-models.R`: about 40 minutes\n\n### Supplemental Information / Appdendix Rmarkdown report\n\nThe SI was created using a R Markdown report that contains some embedded code. See the contents of the `si-text/` folder. The report depends on output generated by the `R/si...` scripts. \n\nIf you are not familiar with R Markdown, the report can be converted to a PDF using this code:\n\n```r\n# if needed: install.packages(\"rmarkdown\") \nlibrary(\"rmarkdown\")\nrmarkdown::render(\"si-text/beg_hil_SI.Rmd\")\n```\n\n## Data\n\nThe data is included in the `data` directory both in R's native RDS format and in CSV form. \n\nMost variables have prefixes indicating the data source:\n\n- `itt_`: Ill-Treatment and Torture data; also binary indicators starting with `yy_` and used in an earlier version\n- `NY.GDP.MKTP.KD` and subequent, including `pop`: World Bank World Development Indicators\n- `v2x_`: V-Dem\n- `regime` and `dd_democracy` from Cheibub, Gandhi, and Vreeland Democracy and dictatorships data\n- `epr_`: Ethnic Power Relations \n- variables from `internal_confl` to `ext_conf_minor`: UCDP ACD\n- `gtd_`: Global terrorism database\n- `ccp_`: Comparative Constitutions Project\n- `gmfd_functionallyfree`: media freedom; see SI\n- `igo_`: COW IGO membership dataset; see SI\n- `NE.TRD.GNFS.ZS`: trade as % of GDP; see SI\n- Human rights organization-related (`hro_`); see SI\n- Time trends (`year_`); see SI\n\n```{r}\ncy \u003c- readRDS(\"data/cy.rds\")\nstr(cy)\n```\n\n\n## R session info\n\n```{r}\nsessionInfo()\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandybega%2Fcmps-itt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandybega%2Fcmps-itt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandybega%2Fcmps-itt/lists"}