Skip to content

opencasestudies/ocs-bp-RTC-analysis

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
img
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

OpenCaseStudies

render-README render-index

Important links

Disclaimer

The purpose of the Open Case Studies project is to demonstrate the use of various data science methods, tools, and software in the context of messy, real-world data. A given case study does not cover all aspects of the research process, is not claiming to be the most appropriate way to analyze a given dataset, and should not be used in the context of making policy decisions without external consultation from scientific experts.

License

This case study is part of the OpenCaseStudies project. This work is licensed under the Creative Commons Attribution-NonCommercial 3.0 (CC BY-NC 3.0) United States License.

Citation

To cite this case study:

Wright, Carrie and Ontiveros, Michael and Meng, Qier and Jager, Leah and Taub, Margaret and Hicks, Stephanie. (2020). https://github.com//opencasestudies/ocs-bp-RTC-analysis. Influence of Multicollinearity on Measured Impact of Right-to-Carry Gun Laws (Version v1.0.0).

Acknowledgments

We would like to acknowledge Daniel Webster for assisting in framing the major direction of the case study. We would also like to thank Elizabeth Stuart and Aboozar Hadavand, and Alexander McCourt for reviewing the case study.

We would like to acknowledge Michael Breshock for his contributions to this case study and developing the OCSdata package.

We would also like to acknowledge the Bloomberg American Health Initiative for funding this work.

Reading Metrics

The total reading time for this case study was calculated with koRpus: **~ 60 minutes**

The Flesch-Kincaid Readability Index was also calculated with koRpus: Grade 11, Age 16

Title

Influence of Multicollinearity on Measured Impact of Right-to-Carry Gun Laws Part 2

Motivation

The influence of the implementation of less restrictive right-to-carry gun laws on violent crime is a historically controversial topic. One reason for the controversy, is concern that some earlier reports examining this topic may have used methods that were inappropriate.

One of the major concerns is that an earlier report included multiple demographic variables that were collinear with one another. This resulted in different a very coefficient estimate for right-to-carry gun law adoption than other reports that did not include collinear variables. This phenomenon is called multicollinearity, and it can result in aberrant findings for particular explanatory variables, despite not altering the overall predictive power of a model.

In this case study we use data perform simplified analyses similar to those of reports on this topic to explore the influence of multicollinearity on coefficient estimate stability. We however, do not recreate the previous analyses. The reports that we use as a guide for our analysis are:

  1. John J. Donohue et al., Right‐to‐Carry Laws and Violent Crime: A Comprehensive Assessment Using Panel Data and a State‐Level Synthetic Control Analysis. Journal of Empirical Legal Studies, 16,2 (2019).

  2. David B. Mustard & John Lott. Crime, Deterrence, and Right-to-Carry Concealed Handguns. Coase-Sandor Institute for Law & Economics Working Paper No. 41, (1996).

Motivating question

  1. What is the effect of multicollinearity on coefficient estimates from linear regression models when analyzing right to carry laws and violence rates?

Data

In this case study, we perform analyses similar to those in Donohue, et al. article and the Lott and Mustard article, however we do not try to recreate them, instead we perform simplified analyses to allow us to focus on multicollinearity.

Therefore we use a subset of the explanatory variables used by each article including:

  1. Data about state demographics in terms of population compositions for age, sex, race, as well as overall population values from the US Census Bureau:
Data Link
years 1977 to 1979 link
years 1980 to 1989 link * county data was used for this decade which also has state information
years 1990 to 1999 link
years 2000 to 2010 link
technical documentation

Six demographic variables are created for the Donohue, et al.-like analysis and 36 were created for the Lott and Mustard-like analysis.

To use this data, we also need Federal Information Processing Standard (FIPS) state codes{target="_blank", to identify what demographic data corresponds to what state. This is also available from the US Census Bureau.

  1. Police staffing data, which was downloaded from the Federal Bureau of Investigation

  2. Unemployment data, which was downloaded from the U.S. Bureau of Labor Statistics.

  3. Poverty data, extracted from Table 21 from this US Census Bureau Poverty Data

  4. Right-to-carry law data, which is available in a table in the Donohue paper

Finally our outcome of interest is violent crime rates. The violent crime data was downloaded from the FBI uniform crime reporting system

Learning Objectives

The skills, methods, and concepts that students will be familiar with by the end of this case study are:

Data Science Learning Objectives:

  1. Create correlation scatterplots and heatmaps (GGally, ggcorrplot)
  2. Creating interactive tables (DT)
  3. Sampling subsets of data (rsample)
  4. Combining multiple plots (cowplot)
  5. Data visualizations with equations and text(ggplot2 and latex2exp)

Statistical Learning Objectives:

  1. Understanding of what multicollinearity is and how it can influence linear regression coefficients
  2. Know how to look for the presence of multicollinearity and determine its severity
  3. Illustrate the difference between multicollinearity and correlation
  4. How to implement panel regression analysis in R (plm)
  5. Define variance inflation factor (VIF) and know how to calculate in R (car)

To see another case study about how the original raw data was imported and wrangled please see here.

Data import and wrangling

See the part 1 case study for the data import and data wrangling details.

Data Visualization

This case study demonstrates how to make correlation plots and scatter plots with error bars. We also show how to add formulas and arrows to plots. The instruction about data visualization assumes that students have some familiarity with ggplot2.

Analysis

This case study covers balanced panel regression model data analysis with fixed effects. In doing so we provide an introduction to longitudinal analysis in general, as well as use of the plm package. We also show how to calculate Variance inflation factor (VIF) values using the car package to quantify the severity of multicollinearity. As another assessment of multicollinearity, we demonstrate how to perform simulations to evaluate the stability of coefficient estimates.

Other notes and resources

Tidyverse
Please see this case study for more details on using ggplot2
Longitudinal studies
Panel data
Confidence intervals
Linear regression
panel regression analysis
Hausmen test Resampling
Variance inflation factor (VIF)
R2 coefficient of determination
Ridge regression
LaTeX mathematical notationtarget="_blank"}

For more information on linear regression see this book and this case study.

For more information on the different types of panel regression models see this book, here, and here.

For more information on implementing panel regression in R using the plm package, see here and here.

For more information on multicollinearity and VIF, see this article.DOI 10.1007/s11135-006-9018-6

The articles used to motivate this case study are:
Lott and Mustard
Donohue, et al.
See here for a list of studies on this topic

Packages used in this case study:

Package Use in this case study
here to easily load and save data
dplyr to arrange/filter/select/compare specific subsets of the data
magrittr to use the compound assignment pipe operator %<>%
purrr to import the data in all the different excel and csv files efficiently
tibble to create data objects that we can manipulate with dplyr/stringr/tidyr/purrr
ggplot2 to create plots
ggrepel to allow labels in figures not to overlap
plm to work with panel data fitting fixed effects and linear regression models
broom to create nicely formatted model output
GGally to extend ggplot2 functionality to easily create more complex plots
ggcorrplot to easily visualize a correlation matrix
rsample to split our sample for the simulation analysis
DT to create interactive and searchable tables
car to calculate VIF values on linear model output
stringr to manipulate the character strings within the data
cowplot to allow plots to be combined
latex2exp to convert latex math formulas to R’s plotmath expressions

For users

There is a Makefile in this folder that allows you to type make to knit the case study contained in the index.Rmd to index.html and it will also knit the README.Rmd to a markdown file (README.md).

For instructors

If instructors want more details about the data import and wrangling for the data used in this analysis, start with this case study.

Target audience

For individuals or classes with some familiarity with regression and ggplot2. See this case study for an introduction to regression.

Suggested homework

Ask students to remove one or more of the demographic variables with high VIF values from the Lott-like panel data and perform the panel linear regression analysis again, as well as actuate the VIF values.

Ask the students to discuss how this possibly changed the results.

Estimate of RMarkdown Compilation Time:

~ About 39 - 49 seconds

This compilation time was measured on a PC machine operating on Windows 10. This range should only be used as an estimate as compilation time will vary with different machines and operating systems.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published