Giter VIP home page Giter VIP logo

myers.r's Introduction

Myers blended digit preference index for R

This is a straightforward implementation of Myers blended digit preference index in R.

Usage

The code depends on the dplyr package. Please install it, before using the code.

Download myers-score.R from this repository and save it to your project's working directory. In R:

library("downloader")
download("https://raw.githubusercontent.com/chmue/myers.R/master/myers-score.R")

Then, use it with the following code:

source("myers-score.R")
myers(target_variable, target_frequency, bin_start = 0, bin_size = 40)

Validation

There are currently two unit tests, which compare the output of the function against previous results. If you clone the complete repository, you can run the unit tests with the following snippet. You need the package testthat.

source("tests/testthat.R")

There is also a small write-up of the validation using the data from Lee & Zhang 2013 (see below.)

Acknowledgements

The code is adapted from Stata code by Germán Rodríguez available here. I also consulted the following research paper for additional guidelines and background on Myers' blended index: Melissa M. Lee and Nan Zhan (2013). The Art of Counting the Governed: Census Accuracy, Civil War, and State Presence. CDDRL Working Papers, Vol. 146. Available here.

The unit tests use two datasets made available by Germán Rodríguez on the introductory website mentioned above (phpop1990.dat and bdblci.dat) and one dataset from Lee & Zhang 1993 (Table OA2.1).

License

The code is available under the GNU General Public License 3 or later.

myers.r's People

Watchers

James Cloos avatar  avatar

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.