With what seems to be a massive increase in gun violence specifically in the United States what are we doing wrong and what are the possible solutions to this issue. In order to create better and safer gun laws we need to analyze who is doing what in regards to gun laws. We also need to look at what is working throughout the world and maybe we can look at what is not working. Gun laws are always changing and vary so much from state to state. No one seems to know the answer to what we should do about the mass amounts of gun related deaths in the United States today. What I want to do in this analysis is compare the number of deaths by gun to the laws in the different states.
The first task that I had to complete for this analysis was finding data on gun laws. Luckily I had help from my professor and he was able to send me a few data sets that were already clean and easy to work with. All I had to do was import them into tableau and into R. This way I was able to create graphs and tables based on the information in the data sets.
Here are links to my data https://www.cdc.gov/nchs/pressroom/sosmap/firearm_mortality/firearm.htm https://giffords.org/lawcenter/resources/scorecard/
library(tidyverse)
library(knitr)
library(dplyr)
library(plotly)
## Warning in system2("/usr/bin/otool", c("-L", shQuote(DSO)), stdout = TRUE):
## running command ''/usr/bin/otool' -L '/Library/Frameworks/R.framework/Resources/
## modules/R_de.so'' had status 1
library(readxl)
gun_related_deaths_by_state <- read_excel("/Volumes/Sam's SSD/Geospatial Gun Laws/gun-related-deaths-by-state.xlsx")
firearms_data %>%
left_join(gun_related_deaths_by_state) -> combined
Next I wanted all of the data in the same place. Instead of 3 different data sets I wanted all the information in one data set. I used the left join function in order to join all the data into one big dataset which I named ‘combined’. Pretty much the same thing was done in tableau in order to make the next two choropleth maps.
library(readxl)
Copy_of_gun_law_grades <- read_excel("/Volumes/Sam's SSD/Geospatial Gun Laws/Copy of gun_law_grades.xlsx")
combined %>%
left_join(Copy_of_gun_law_grades) -> combined
## Joining, by = "State"
The important number in this statistical summary is the p value. The P value is a decimal value that tells whether or not your results are random. If you have a P value of 0.045 that means that there is a 4.5% chance that the results are random. Our P value in the statistical analysis is 0.00002057. This means that there is a strong correlation between the gun related deaths per state in 2020 and the gun laws in that state.
combined %>%
group_by(Grade) %>%
summarise(mean = mean(`2020 gun-related deaths per 100,000`)) %>%
ggplot(aes(Grade, mean)) + geom_col() -> plot2
ggplotly(plot2)
options(scipen=999)
reg <- lm(Grade~`2020 gun-related deaths per 100,000`, data=combined)
summary(reg)
##
## Call:
## lm(formula = Grade ~ `2020 gun-related deaths per 100,000`, data = combined)
##
## Residuals:
## Min 1Q Median 3Q Max
## -69.53 -25.96 4.90 29.63 59.88
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 99.3961 12.9686 7.664
## `2020 gun-related deaths per 100,000` -4.0910 0.8662 -4.723
## Pr(>|t|)
## (Intercept) 0.000000000711 ***
## `2020 gun-related deaths per 100,000` 0.000020567766 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 35.24 on 48 degrees of freedom
## Multiple R-squared: 0.3173, Adjusted R-squared: 0.3031
## F-statistic: 22.31 on 1 and 48 DF, p-value: 0.00002057
This choropleth map shows the grade given to each state based on how safe their gun laws are. The main aspect that catches the eye from this map is the amount of F’s given. A majority of states were graded at the F grade which means their gun laws are not adequate.
There are a lot of states that need to improve their gun laws according to the grade map. There is however a large outlier. One state who graded pretty average but had an unique amount of gun-related deaths. From this I feel that a solid conclusion can not be made and more research into the outlier is necessary. The one outlier that we had in the data was for New Mexico which has a high amount of gun related deaths in 2020 when compared to the rank it got for the safety of their gun laws. After some research I found a few interesting facts on the New Mexico Department of Health website. First that, gun related deaths in New Mexico have increased by 55% from 2010 to 2020, and that in 2020, the Governor of New Mexico signed into law the Extreme Risk Firearm Protection Order Act (Senate Bill 5) which provides for the issuance of court orders for the relinquishment of firearms for a designated period when there is an indication of significant risk of violence or harm to self or others. From the P value we can conclude that there is correlation between the laws that a state has regarding guns and the amount of gun related deaths per 100,000. If we want less gun related deaths we need to look towards palces with the least amount of gun realted deaths and look into their laws and implement the ones that work.