Giter Club home page Giter Club logo

article_riding-volatility's Introduction

Replicable code: On Volatility and Parties’ Potential for Growth in Multiparty Systems: The Case of the 2022 Quebec Election

This README follows the guidelines for data replication of The Journal of Politics of the University of Chicago Press. These guidelines can be found here: https://www.journals.uchicago.edu/journals/jop/data-replication

This article can be replicated using R version 4.1.3. We consider opening the article_riding-volatility.Rproj to work in this repo.

Packages to install

devtools::install_github("clessn/clessnverse")

Ethical constraints

The surveys used in this article were exclusive, and access to the data was conditional upon signing an ethics form. As a result, the table1_respondentsRCI dataset presented here is a shortened version of the full dataset used in this study. If you are interested in accessing additional variables or data, please contact us at [email protected] to discuss the possibility of obtaining access.

In the mrp folder where basic socio-demographic variables are necessary, the mrp/codes/1_simulate_survey_data.R allows the replicator to simulate the individual socio-demographic variables of respondents.

Datasets

Information about the datasets are in the codebook.md file.

Code files

functions.R

This script contains relevant functions to the analysis. It can be sourced at the start of coding files.

generate_table3.R

This script merges data from data/table1_respondentsRCI, data/table2_duringCampaign and mrp/data/table_post_strat_fragility to generate table3_aggregatedData. It aggregates data from table1_respondentsRCI and table2_duringCampaign at the riding-level to calculate the vote fragility index (with and without MRP) and campaign volatility for each riding. It is not needed to run this script as table3_aggregatedData is already in the data folder.

figure1_rciDistribution.R

This script takes data from table1_respondentsRCI to generate graphs/figure1_rciDistribution.png.

figure2_RCI_prob_voteInt.R

This script takes data from data/table1_respondentsRCI.rds, mrp/data/simulated_survey_data.rds and mrp/data/post_strat_table.rds to generate figure2_prob_voteInt.png.

figure3_fragilityIndexDistribution.R

This script takes data from table3_aggregatedData to generate graphs/figure3_fragilityIndexDistribution.png.

figure4_campaignVolatilityDistribution.R

This script takes data from table3_aggregatedData to generate graphs/figure4_campaignVolatilityDistribution.png.

figure5_fragilityVSvolatility.R

This script takes data from table3_aggregatedData to generate graphs/figure5_fragilityVSvolatility.png.

chi_square_test.R

This script takes data from table3_aggregatedData to do a chi-squared test. You can read this section of An Introduction to Political and Social Data Analysis Using R of Thomas M. Holbrook for more documentation about the chi-squared test.

regressions.R

This script takes data from data/table3_aggregatedData.rds and mrp/data/census_data.rds to generate the regression table presented in this article.

article_riding-volatility's People

Contributors

hubcad25 avatar williampo1 avatar

Stargazers

 avatar

Watchers

 avatar

article_riding-volatility's Issues

Add robust SE to regression models

For each model :
vmA1 <- sandwich::vcovHC(modelA1, type = 'HC1')

then in stargazer:

se=c(list(sqrt(diag(vmA1))),
                          list(sqrt(diag(vmA2))), ...

Review code / documentation

Suggestions

Documentation, replication etc:

  • Cite properly Qc125.com as data source in README for generate_table3.R
  • Move dataset variable description from the README into a codebook. Can be a separate .md file
  • #4
  • Write repo description in GitHub
  • #3

Style:

  • #5
  • If there is a particular order you should run R scripts, can number them like 1_tidy_data.R

Details:

Highlights

  • Looked at the JOP dataverse and this repo is quite well organized compared to some of their content!
  • Very easy to read and understand what's happening without running the scripts
  • Files are well organised and documented

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.