{"id":23418429,"url":"https://github.com/bgonzalezbustamante/quant-methods-elites","last_synced_at":"2025-04-09T08:20:45.165Z","repository":{"id":38975677,"uuid":"455969529","full_name":"bgonzalezbustamante/quant-methods-elites","owner":"bgonzalezbustamante","description":"Quantitative Methods for Studying Elites: Demonstration for R","archived":false,"fork":false,"pushed_at":"2022-11-25T23:14:21.000Z","size":749,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-15T02:30:38.976Z","etag":null,"topics":["cabinets","cox-regression","deputy","glm","political-science","propensity-score","senators","survival-analysis"],"latest_commit_sha":null,"homepage":"https://doi.org/10.5281/zenodo.6098061","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc-by-4.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bgonzalezbustamante.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-CC.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null}},"created_at":"2022-02-05T19:46:22.000Z","updated_at":"2022-11-25T23:00:31.000Z","dependencies_parsed_at":"2022-09-15T03:01:36.546Z","dependency_job_id":null,"html_url":"https://github.com/bgonzalezbustamante/quant-methods-elites","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgonzalezbustamante%2Fquant-methods-elites","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgonzalezbustamante%2Fquant-methods-elites/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgonzalezbustamante%2Fquant-methods-elites/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgonzalezbustamante%2Fquant-methods-elites/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bgonzalezbustamante","download_url":"https://codeload.github.com/bgonzalezbustamante/quant-methods-elites/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248000087,"owners_count":21031100,"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":["cabinets","cox-regression","deputy","glm","political-science","propensity-score","senators","survival-analysis"],"created_at":"2024-12-23T00:19:27.211Z","updated_at":"2025-04-09T08:20:45.143Z","avatar_url":"https://github.com/bgonzalezbustamante.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# quant-methods-elites\n**Quantitative Methods for Studying Elites: Demonstration for R**\n\n[![Version](https://img.shields.io/badge/version-v1.0.0-blue.svg)](CHANGELOG.md) [![Project Status: Inactive – The project has reached a stable, usable state but is no longer being actively developed; support/maintenance will be provided as time allows.](https://www.repostatus.org/badges/latest/inactive.svg)](STATUS.md) [![GitHub issues](https://img.shields.io/github/issues/bgonzalezbustamante/quant-methods-elites.svg)](https://github.com/bgonzalezbustamante/quant-methods-elites/issues/) [![GitHub issues-closed](https://img.shields.io/github/issues-closed/bgonzalezbustamante/quant-methods-elites.svg)](https://github.com/bgonzalezbustamante/quant-methods-elites/issues?q=is%3Aissue+is%3Aclosed) [![DOI](https://zenodo.org/badge/455969529.svg)](https://zenodo.org/badge/latestdoi/455969529) [![License](https://img.shields.io/badge/license-GNU%20GPLv3-black)](LICENSE-GPL.md) [![License](https://img.shields.io/badge/license-CC%20BY%204.0-black)](LICENSE-CC.md) [![R](https://img.shields.io/badge/made%20with-R%20v4.1.0-1f425f.svg)](https://cran.r-project.org/) [![Latex](https://img.shields.io/badge/made%20with-LaTeX-1f425f.svg)](https://www.latex-project.org/)\n\n## Overview\n\nThis repository contains demonstrations for `R` of generalised linear models and proportional hazards Cox regressions to measure the impact of individual business trajectories on the access and permanence in political positions in the Chilean executive and legislative branches. These demonstrations are the primary analysis of the forthcoming methodological article entitled “*Métodos cuantitativos para estudiar a las élites: Aplicaciones prácticas, sesgos y potencialidades*”.[^1]\n\nIn addition, it contains an anonymised, sliced data set from the Chilean Elite Survey (1990-2010) (*N* = 386) in Comma-Separated Values `CSV` format with Unicode encoding `UTF-8` based on the latest update by Joignant and González-Bustamante (2014).[^2] The second data set used in the demonstrations is González-Bustamante and Olivares (2022).[^3]\n\n## Metadata and Preservation\n\nThis code and data are stored with version control on a GitHub repository. Furthermore, a Digital Object Identifier is provided by Zenodo.\n\n``` r\nquant-methods-elites\n|-- .Rprofile\n|-- .gitignore\n|-- CHANGELOG.md\n|-- CITATION.cff\n|-- CODE_OF_CONDUCT.md\n|-- LICENSE-CC.md\n|-- LICENSE-GPL.md\n|-- README.md\n|-- STATUS.md\n|-- quant-methods-elites.Rproj\n|-- renv.lock\n|-- code\n    |-- stage_0_descriptives.R\n    |-- stage_1_data_cleaning.R\n    |-- stage_2_glm.R\n    |-- stage_3_cox.R\n|-- data\n    |-- raw\n        |-- chamber_1990_1994.csv\n        |-- chamber_1994_1998.csv\n        |-- chamber_1998_2002.csv\n        |-- chamber_2002_2006.csv\n        |-- chamber_2006_2010.csv\n        |-- chamber_2010_2014.csv\n    |-- tidy\n        |-- elite_survey_2010.csv\n|-- refs\n    |-- BIB-QM-Elites.bib\n|-- renv\n    |-- .gitignore\n    |-- activate.R\n    |-- settings.dcf\n|-- results\n    |-- figures\n        |-- figure_01a.png\n        |-- figure_01b.png\n        |-- figure_02.png\n        |-- figure_03a.jpg\n        |-- figure_03b.jpg\n        |-- figure_03c.jpg\n        |-- figure_04.jpg\n    |-- tables\n        |-- table_01.html\n        |-- table_01.tex\n        |-- table_02.html\n        |-- table_02.tex\n        |-- table_03.html\n        |-- table_03.tex\n```\n\n9 directories and 39 files.\n\nIn addition, this README file in Markdown `MD` format provides specific information to ensure the replicability of the code.\n\n## Storage and Backup\n\nThe GitHub repository has controlled access with Two-Factor Authentication `2FA` with two physical USB security devices (Bastián González-Bustamante, [ORCID iD 0000-0003-1510-6820](https://orcid.org/0000-0003-1510-6820)). Both USB keys issue one-time passwords to generate a cryptographic authentication `FIDO2` and `U2F`.\n\nMoreover, the repository is backed up on Hierarchical File Server `HFS` for recovery in case of incidents. This backup is located on the University of Oxford hub connected to `Code42` Cloud Backup encrypted with `256-bit AES`. The backup is performed with every change on GitHub and receives weekly light maintenance and a deep one every month. This backup will be secured until May 2024. An extension of this period will be evaluated on budget availability.\n\n## Getting Started\n\n### Software\n\nWe used `R v4.1.0 -- Camp Pontanezen` and the following packages: `foreign v0.8-81`, `performance v0.8.0`, `pscl v1.5.5`, `sjPlot v2.8.9`, `stargazer v5.2.2`,\t`survival v3.2-11` and `tidyverse v1.3.1`. In addition, we have used `ggplot2 v3.3.3` as a dependency.\n\nPropensity score estimation, under embargo, was carried out using `MatchIt v4.2.0`, `cobalt v4.3.1`, `lmtest v0.9-38`, `sandwich v3.0-1` and, as a dependency, `optmatch v0.9-14`. A more complex code is already released as supplementary material in González-Bustamante (2022).[^4]\n\nWe recommend that users run replication code and scripts from the root directory using the `R` project `quant-methods-elites.Rproj` or, if they wish, import the anonymised, sliced data set from the Chilean Elite Survey (1990-2010) directly using the code below. The instructions for importing data on cabinets are available on this [**GitHub repository**](https://github.com/bgonzalezbustamante/chilean-ministers/).\n\n### Import Data\n\n#### R Code\n\n``` r\n## GitHub Repository\ngithub_1 \u003c- \"https://raw.githubusercontent.com/\"\ngithub_2 \u003c- \"bgonzalezbustamante/quant-methods-elites/main/data/tidy/\"\n\n## Elite Survey Data\nelite_survey \u003c- read.csv(paste(github_1, github_2, \"elite_survey_2010.csv\", sep = \"\"),\n                              header = T, sep = \",\", encoding = \"UTF-8\")\n```\n#### Python Code\n\n``` python\nimport pandas as pd\n\n## GitHub Repository\ngithub_1 = \"https://raw.githubusercontent.com/\"\ngithub_2 = \"bgonzalezbustamante/quant-methods-elites/main/data/tidy/\"\n\n## Elite Survey Data\nurl = github_1 + github_2 + \"elite_survey_2010.csv\"\ndf = pd.read_csv(url, index_col=0)\n```\n\n### Replication Instructions\n\nFolder `code` contains the `R` scripts.\n\nSubfolders `results/figures` and `results/tables` include all plots and tables provided as `PNG`, `JPG`, `HTML`, and `TeX` files, respectively.\n\n- **Stage 1.** Please do not run `R` script `stage_1_data_cleaning.R` from the \"code\" folder since it requires complete, non-anonymised data sets under embargo.\n\n- **Stage 2.** Run script `stage_2_glm.R` from the `code` folder. This script contains GLMs demonstrations for `R`. Model after matching is not available for the moment since the propensity score chunk is still under embargo.\n\n- **Stage 3.** Run script `stage_3_cox.R` from the `code` folder. This script contains proportional hazards models for `R`. Model after matching is not available for the moment since the propensity score chunk is still under embargo.\n\nThe file `stage_0_descriptives.R` contains a descriptive code for the Chamber of Deputies using a sliced data set from González-Bustamante and Cisternas (2016).[^5] This is not necessary for the models.\n\nTo ensure the replicability of our analyses, we used project-local R dependency with `renv v0.16.0`.\n\n``` r\nlibrary(renv)\nrenv::init()\nrenv::install(\"tidyverse@1.3.1\")\nrenv::install(\"foreign@0.8-81\")\nrenv::install(\"performance@0.8.0\")\nrenv::install(\"pscl@1.5.5\")\nrenv::install(\"stargazer@5.2.2\")\nrenv::install(\"sjPlot@2.8.9\")\nrenv::install(\"ggplot2@3.3.3\")\nrenv::install(\"MatchIt@4.2.0\") ## PSA code under embargo\nrenv::install(\"cobalt@4.3.1\") ## PSA code under embargo\nrenv::install(\"lmtest@0.9-38\") ## PSA code under embargo\nrenv::install(\"sandwich@3.0-1\") ## PSA code under embargo\nrenv::install(\"optmatch@0.9-14\") ## PSA code under embargo\nrenv::install(\"survival@3.2-11\")\nrenv::snapshot()\nrenv::status()\n```\n\n### Codebook\n\nThe file `elite_survey_2010.csv` in `data/tidy` subfolder is the anonymised, sliced data set on Chilean elite between 1990 and 2010. This set contains 386 observations.\n\n- `id`. Unique ID per case.\n\n- `sex`. Case sex.\n\n- `dob`. Date of birth.\n\n- `political_capital`. A nominal variable indicating the highest post in a political party: national, regional, local level, none formal position.\n\n- `education`. A nominal variable indicating the highest educational level: primary school, high school, BA/BPS completed, technical career achieved, unfinished college or technical career, graduate studies without a degree, MA/MBA, PhD, PhD candidate.\n\n- `school`. A nominal variable indicating the type of primary school: secular private, religious private, subsidised private, local government school, or public primary school.\n\n- `family_capital`. A dummy variable indicating whether the case's parents held government first-line positions (*i.e.*, minister, undersecretary or senior public manager) or was a congressman or congresswoman.\n\n- `capital_father`. A dummy variable indicating whether the case's father held government first-line positions (*i.e.*, minister, undersecretary or senior public manager) or was a congressman or congresswoman.\n\n- `capital_mother`. A dummy variable indicating whether the case's mother held government first-line positions (*i.e.*, minister, undersecretary or senior public manager) or was a congressman or congresswoman.\n\n- `party_1`. A nominal variable indicating partisanship in chronological order (first option).\n\n- `party_2`. A nominal variable indicating partisanship in chronological order (second option).\n\n- `party_3`. A nominal variable indicating partisanship in chronological order (third option).\n\n- `party_4`. A nominal variable indicating partisanship in chronological order (fourth option).\n\n- `t1`. A nominal variable indicating public and private careers in chronological order (first post).\n\n- `t2`. A nominal variable indicating public and private careers in chronological order (second post).\n\n- `t3`. A nominal variable indicating public and private careers in chronological order (third post).\n\n- `t4`. A nominal variable indicating public and private careers in chronological order (fourth post).\n\n- `t5`. A nominal variable indicating public and private careers in chronological order (fifth post).\n\n- `t6`. A nominal variable indicating public and private careers in chronological order (sixth post).\n\n- `t7`. A nominal variable indicating public and private careers in chronological order (seventh post).\n\n- `t8`. A nominal variable indicating public and private careers in chronological order (eighth post).\n\n- `t9`. A nominal variable indicating public and private careers in chronological order (ninth post).\n\n- `exp_business`. A dummy variable indicating whether the case has a previous trajectory as a CEO.\n\n- `president`. A dummy variable indicating whether the case's highest political post was president.\n\n- `minister`. A dummy variable indicating whether the case's highest political post was minister.\n\n- `senator`. A dummy variable indicating whether the case's highest political post was senator.\n\n- `deputy`. A dummy variable indicating whether the case's highest political post was deputy.\n\n- `undersecretary`. A dummy variable indicating whether the case's highest political post was undersecretary (*i.e.*, viceminister).\n\n- `intendant`. A dummy variable indicating whether the case's highest political post was intendant.\n\n- `ceo`. A dummy variable indicating whether the case's highest political post was senior public manager.\n\n- `cabinet_chief`. A dummy variable indicating whether the case's highest political post was cabinet chief.\n\n- `party_leader`. A dummy variable indicating whether the case's highest political post was party leader.\n\n## License\n\nThe content of this project itself is licensed under a [Creative Commons Attribution 4.0 International license (CC BY 4.0)](LICENSE-CC.md), and the underlying code used to format and display that content is licensed under an [GNU GPLv3 license](LICENSE-GPL.md).\n\nThe above implies that the data set may be shared, reused, and adapted as long as appropriate acknowledgement is given. In addition, the code may be shared, reused, and adapted as long as the source is disclosed, the changes are stated, and the same [GNU GPLv3 license](LICENSE-GPL.md) is used.\n\n## Contribute\n\nContributions are entirely welcome. You just need to [open an issue](https://github.com/bgonzalezbustamante/quant-methods-elites/issues/new) with your comment or idea.\n\nFor more substantial contributions, please fork this repository and make changes. Pull requests are also welcome.\n\nPlease read our [code of conduct](CODE_OF_CONDUCT.md) first. Minor contributions will be acknowledged, and significant ones will be considered on our contributor roles taxonomy.\n\n## Citation\n\nGonzález-Bustamante, B. (2022). Quantitative Methods for Studying Elites: Demonstration for R (Version 1.0.0 -- Quiet Hill) [Computer software]. DOI: [10.5281/zenodo.6098061](https://doi.org/10.5281/zenodo.6098061)\n\n## Author\n\nBastián González-Bustamante \\\nbastian.gonzalezbustamante@politics.ox.ac.uk \\\n[ORCID iD 0000-0003-1510-6820](https://orcid.org/0000-0003-1510-6820) \\\nhttps://bgonzalezbustamante.com\n\n## CRediT - Contributor Roles Taxonomy\n\nBastián González-Bustamante ([ORCID iD 0000-0003-1510-6820](https://orcid.org/0000-0003-1510-6820)): Conceptualisation, data curation, formal analysis, methodology, resources, software, validation, visualisation, writing – original draft, and writing – review and editing.\n\nAlfredo Joignant ([ORCID iD 0000-0002-5811-0988](https://orcid.org/0000-0002-5811-0988)): Data curation, funding acquisition, project administration, resources, supervision, and validation.\n\nGonzalo Delamaza ([ORCID iD 0000-0002-5418-3135](https://orcid.org/0000-0002-5418-3135)): Resources and supervision.\n\nHernán Cuevas ([ORCID iD 0000-0002-4295-5652](https://orcid.org/0000-0002-4295-5652)): Resources and supervision.\n\nManuel Gárate ([ORCID iD 0000-0002-0016-596X](https://orcid.org/0000-0002-0016-596X)): Resources and supervision.\n\nANID/FONDECYT 1100877 Research Team: Investigation.[^6]\n\n### Latest Revision\n\n[November 25, 2022](CHANGELOG.md).\n\n[^1]: González-Bustamante, B. (2022, *forthcoming*). Métodos cuantitativos para estudiar a las élites: Aplicaciones prácticas, sesgos y potencialidades. *Revista Chilena de Derecho y Ciencia Política*. SocArXiv: [10.31235/osf.io/5m2ur](https://doi.org/10.31235/osf.io/5m2ur).\n[^2]: Joignant, A., \u0026 González-Bustamante, B. (2014). El núcleo de la élite política chilena 1990-2010. Proyecto Fondecyt 1100877. Working Paper, Universidad Diego Portales.\n[^3]: González-Bustamante, B., \u0026 Olivares, A. (2022). Data Set on Chilean Ministers (1990-2014) (Version 3.3.6 -- Dry Bonus) [Data set]. DOI: [10.5281/zenodo.5744536](https://doi.org/10.5281/zenodo.5744536).\n[^4]: González-Bustamante, B. (2022). Ministerial Stability During Presidential Approval Crises: The Moderating Effect of Ministers’ Attributes on Dismissals in Brazil and Chile. *The British Journal of Politics and International Relations*. OnlineFirst. DOI: [10.1177/13691481221124850](https://doi.org/10.1177/13691481221124850).\n[^5]: González-Bustamante, B., \u0026 Cisternas (2016). Élites políticas en el poder legislativo chileno: La Cámara de Diputados (1990-2014). *Política, Revista de Ciencia Política, 54*(1), 19-52.\n[^6]: For contributions related to cabinet data, see this [GitHub repository](https://github.com/bgonzalezbustamante/chilean-ministers/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbgonzalezbustamante%2Fquant-methods-elites","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbgonzalezbustamante%2Fquant-methods-elites","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbgonzalezbustamante%2Fquant-methods-elites/lists"}