Git Product home page Git Product logo

nibrs's Introduction

Racial Disparities in the Enforcement of Marijuana Violations in the US

Installation

Data

To download the existing datasets, reports, and maps, you must install DVC:

pip install dvc[gs]

Followed by:

dvc pull

This should automatically download all the required datasets.

Python

To install the required python libraries, please install a fresh python environment (using anaconda or such like), then run the command:

pip install -r requirements.txt

pointing to the requirements.txt file in the NIBRS directory.

Reproducing the Results

Enforcement Ratios

In order to produce the enforcement ratios you must either download the pre-requisite datasets from DVC, using dvc pull, or you may produce all results yourself using the following steps:

  1. Download the appropriate raw NIBRS files for each state. This can be achieved by running the python script: python data_downloading/download_and_extract.py. This currently defaults to downloading years 2010-2019 and over all states. This can be changed from within the script.

  2. Produce the appropriate NIBRS dataset. Using the query_nibrs.py python script python scripts/python/data_processing/query_nibrs.py. The script has a number of arguments that can be explored with: python query_nibrs.py -h.

  3. Produce the enforcement ratios. Run the selection_ratio.py script scripts/python/data_processing/selection_bias.py with appropriate arguments. Run scripts/python/data_processing/selection_bias.py -h for help, or consult the image below:

Paper Figures

There are many scripts used to create the figures and tables in the paper, please consult the table below to find which script corresponds to which figure:

Figures

Figure Script
1 R/generate_plots_4paper.R
2 python/enforcement_ratio_model_plots.py
3 R/generate_plots_4paper.R
S1 python/nsduh_usage_plot.py
S2 R/generate_plots_4paper.R
S3 python/enforcement_ratio_location_plot.py
S4 python/legalized_states_agency_reporting_plot.py
S5 python/enforcement_rate_by_demographic.py
S6 python/enforcement_rate_by_demographic.py
S7 R/generate_plots_4paper.R
S8 python/enforcement_ratio_model_plots.py
S9 R/generate_plots_4paper.R
S10 python/enforcement_ratio_model_plots.py
S11 R/generate_plots_4paper.R
S12 python/enforcement_ratio_model_plots.py
S13 R/generate_plots_4paper.R
S14 python/enforcement_ratio_model_plots.py
S15 R/generate_plots_4paper.R
S16 Doesn't exist in paper? Bug in latex maybe?
S17 python/enforcement_ratio_model_plots.py
S18 R/generate_plots_4paper.R
S19 python/time_distribution_plot.py + python/enforcement_ratio_model_plots.py
S20 R/generate_plots_4paper.R

Tables

Table Script
1 N/A
2 python/enforcement_ratio_n_counties_table.py
3 R/process_usage_data_nsduh.R
4 R/get_stats_on_nibrs.R
5 python/opportunity_atlas_regression_table.py + python/time_regression_table.py
S1 R/process_usage_data_nsduh.R
S2 R/get_stats_on_nibrs.R
S3 R/get_stats_on_nibrs.R
S4 R/get_stats_on_nibrs.R
S5 python/opportunity_atlas_regression_table.py + python/time_regression_table.py

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.