Giter VIP home page Giter VIP logo

ei_project's Introduction

The R script takes as its input ethnic population totals and party vote totals from each political unit. Ecological inference estimates, in terms of percentages of each ethnic group's vote toward each political party, are then exported with additional descriptive information to an .xlsx file format.

The following indices are in reference to the imported data frame. They each are to be written as a vector of integers.

Object alpha contains the column indices of each political party.

Object bravo contains the column indices of each main ethnic group.

Object charlie contains the column index or indices of the ethnic group(s) labelled Other.

Object delta contains the column index or indices of the ethnic group(s) labelled Unknown.

The ethnic groups used to compose objects charlie and delta are compiled at the user's discretion. If no group applies, either or both objects can be left NULL. Objects alpha and bravo must be filled.

Additionally, a string value representing the desired output file name is needed for object xray.

The sum of objects bravo,charlie, and delta is used as the total population of each unit. Percentages of each party and ethnic group are computed in relation to this total population figure. The number of non-voters in each unit are computed as the difference between the total population and the total number of valid votes.

From theeiPack R package, ei.MD.bayes() is used to complete the analysis. This function implements a hierarchical Multinomial-Dirichlet model for ecological inference in RxC tables. Draws from the posterior are obtained with a Metropolis-within-Gibbs algorithm. More information on the methodology can be found in the package's R manual included in the repository.

The code now accounts for mismatched political units. Previously, the total population must have been greater than the total number of valid votes for each political unit in order to be included. Mismatched units are now retotaled as a percentage of the valid votes with the assumption of complete voter-turnout, then resubmitted into the analysis. Realigned data are still exported with the results in a separate Excel tab for further inspection.

There are still a few additional bugs that need fixing. If you come across any of these issues please let me know.

ei_project's People

Contributors

jlavicka avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

bstokes4102

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.