DACSS 697 Blog Post #5: progress on research project - new data source scraped successfully and some basic topic modeling
Is there a relationship between the restrictiveness of a state’s firearm regulations/laws for individuals with domestic violence related criminal records and intimate partner homicide rates perpetrated by a firearm?
Each state varies in the number and restrictiveness of gun laws. In particular, states differ in how they regulate the possession of firearms for individuals with domestic violence (intimate partner violence) related charges/restraining orders and if/how firearms can be seized from these individuals.
In this research, intimate partner homicide is defined as the killing of an individual perpetrated by a former or current spouse or partner (ex. girlfriend/boyfriend) of the victim.
At this time, there has been plentiful research noting the high number of intimate partner homicides perpetrated using a firearm in the United States. I will include some examples of applicable research findings below to show the relevance of this issue and to justify the use of state firearm homicide rates (due to lack of intimate-partner-homicide specific data):
From 2002: “Nearly one-third of all women murdered in the United States in recent years were murdered by a current or former intimate partner… Of females killed with a firearm, almost two-thirds of were killed by their intimate partners… Access to firearms increases the risk of intimate partner homicide more than five times more than in instances where there are no weapons, according to a recent study.” Source
From 2017: “Every year, more than 1800 persons in the United States are killed by their intimate partners, and approximately 50% of these homicides are committed with firearms. Approximately 85% of victims of intimate partner homicide (IPH) are women, and IPH accounts for nearly 50% of all homicides involving women in the United States each year.” Source
From 2022: “In an average month, 57 women are shot and killed by an intimate partner—and over 4.5 million American women report being threatened with a gun by an intimate partner.” Source
Given the prevalence of intimate partner homicides using a firearm, this research project aims to investigate how state legislation regulating firearm possession and seizures may influence intimate partner homicide rates.
Source: https://wonder.cdc.gov/ucd-icd10.html
The Centers for Disease Control and Prevention (CDC) provides CDC Wonder, which is an online database that allows for the collection and analysis of public health data. I am using the Underlying Cause of Death database, which allows the selection of Homicide as the Injury Intent and the specification of Firearm as the Injury Mechanism, and the information is determined through death certificates.
I decided to use an average across 3 years to account for any single year abnormalities. The state firearm laws are from 2018. I do not have information on how long each state has had each firearm provision enacted, so I am using homicide rates averages for 2017 through 2019.
# importing data
HomRates <- read.delim("../../DACSS 697/DV Research/Homicide_Firearm_2017through2019.txt")
HomRates <- HomRates %>%
select(State, Deaths, Population, Crude.Rate)
A <- function(x) x/3
HomRates1 <- sapply(HomRates[2:4], A) %>%
data.frame()
HomRates1 <- HomRates1 %>%
add_column(State = HomRates$State)
HomRates1 <- HomRates1[, c('State', 'Crude.Rate', 'Deaths', 'Population')]
HomRates1$State[HomRates1$State == ""] <- NA
HomRates1 <- na.omit(HomRates1) %>%
filter(!str_detect(`State`, "District of Columbia"))
HomRates1 <- HomRates1 %>%
mutate_at(vars(-State), funs(round(., 1)))
HomRates1 <- HomRates1 %>%
mutate_at(vars(Population), funs(round(., 0)))
kable(HomRates1, col.names = c("State", "Crude Rate (per 100,000)", "Deaths", "Population"), align = c('c', 'c', 'c', 'c'), caption = "Average State Homicide Rates by a Firearm (2017-2019)") %>%
kable_styling() %>%
scroll_box(width = "100%", height = "400px")
| State | Crude Rate (per 100,000) | Deaths | Population |
|---|---|---|---|
| Alabama | 3.3 | 486.7 | 4888601 |
| Alaska | 2.0 | 44.7 | 736259 |
| Arizona | 1.4 | 294.0 | 7155544 |
| Arkansas | 2.2 | 198.0 | 3011969 |
| California | 1.1 | 1318.7 | 39535307 |
| Colorado | 1.0 | 170.7 | 5687151 |
| Connecticut | 0.6 | 64.0 | 3575379 |
| Delaware | 1.7 | 49.3 | 967625 |
| Florida | 1.5 | 979.0 | 21253821 |
| Georgia | 2.1 | 667.0 | 10522092 |
| Hawaii | 0.3 | 12.7 | 1421300 |
| Idaho | 0.5 | 25.3 | 1752739 |
| Illinois | 2.2 | 836.3 | 12738308 |
| Indiana | 1.8 | 363.3 | 6696972 |
| Iowa | 0.5 | 50.0 | 3152309 |
| Kansas | 1.4 | 119.7 | 2912647 |
| Kentucky | 1.6 | 212.0 | 4463421 |
| Louisiana | 3.7 | 524.3 | 4664368 |
| Maine | 0.3 | 10.7 | 1339508 |
| Maryland | 2.5 | 449.3 | 6046858 |
| Massachusetts | 0.5 | 100.7 | 6884824 |
| Michigan | 1.5 | 458.3 | 9981694 |
| Minnesota | 0.5 | 82.0 | 5609139 |
| Mississippi | 3.7 | 327.0 | 2982260 |
| Missouri | 3.0 | 552.3 | 6125804 |
| Montana | 0.7 | 21.7 | 1060525 |
| Nebraska | 0.5 | 31.3 | 1927917 |
| Nevada | 1.6 | 143.0 | 3037529 |
| New Hampshire | 0.3 | 14.0 | 1352988 |
| New Jersey | 0.8 | 224.0 | 8932118 |
| New Mexico | 2.1 | 131.7 | 2093442 |
| New York | 0.6 | 331.3 | 19615056 |
| North Carolina | 1.7 | 517.3 | 10381708 |
| North Dakota | 0.5 | 10.3 | 759177 |
| Ohio | 1.6 | 578.0 | 11679050 |
| Oklahoma | 1.9 | 219.7 | 3943638 |
| Oregon | 0.6 | 72.7 | 4183742 |
| Pennsylvania | 1.5 | 577.0 | 12804862 |
| Rhode Island | 0.4 | 11.7 | 1058772 |
| South Carolina | 2.5 | 388.0 | 5085737 |
| South Dakota | 0.5 | 12.7 | 878853 |
| Tennessee | 2.4 | 481.7 | 6771723 |
| Texas | 1.4 | 1232.7 | 28667441 |
| Utah | 0.5 | 46.0 | 3156299 |
| Vermont | 0.4 | 7.3 | 624648 |
| Virginia | 1.3 | 340.3 | 8507741 |
| Washington | 0.7 | 167.7 | 7518742 |
| West Virginia | 1.3 | 70.3 | 1804612 |
| Wisconsin | 0.9 | 155.0 | 5810495 |
| Wyoming | 0.7 | 12.0 | 578604 |
Source: https://www.cdc.gov/injury/wisqars/nvdrs/
The National Violent Death Reporting System (NVDRS) is a product of the CDC and specifically the Web-based Injury Statistics Query and Reporting System (WISQARS). This database provides data specifically on confirmed homicides perpetrated by an intimate partner and using a firearm, as opposed to the CDC WONDER dataset above of firearm homicide rates. Confirmed intimate partner homicide (IPH) rates are not available for all states or years, but that will likely change as the CDC began providing NVDRS funding to all states in 2018. The system allows for states to combine law enforcement reports, medical examiner/coroner reports, and death certificates when reporting and surveilling public health matters like homicide.
To align with the CDC dataset, this dataset covers 2017 through 2019. One problematic character of this set is that it supresses counts less than 10 (for confidentiality reasons).
NVDRSall <- read_csv("../../DACSS 697/DV Research/NVDRS_IPH_2017-2019.csv", skip = 6)
NVDRSall <- NVDRSall %>%
select("...1", "Number of Deaths...2", "Population...3", "Crude Rate...4", "Number of Deaths...6", "Population...7", "Crude Rate...8", "Number of Deaths...10", "Population...11", "Crude Rate...12", "Number of Deaths...14", "Population...15", "Crude Rate...16") %>%
rename('State' = "...1", '2017_Deaths' = "Number of Deaths...2", '2017_Population' = "Population...3", '2017_Crude_Rate' = "Crude Rate...4", '2018_Deaths' = "Number of Deaths...6", '2018_Population' = "Population...7", '2018_Crude_Rate' = "Crude Rate...8", '2019_Deaths' = "Number of Deaths...10", '2019_Population' = "Population...11", '2019_Crude_Rate' = "Crude Rate...12", 'Total_Deaths' = "Number of Deaths...14", 'Avg_Population' = "Population...15", 'Avg_Crude_Rate' = "Crude Rate...16")
NVDRSall <- NVDRSall %>%
filter(!str_detect(`State`, "TOTAL"))%>%
filter(!str_detect(`State`, "State"))%>%
filter(!str_detect(`State`, "District of Columbia"))
NVDRSall$Avg_Population <- as.numeric(as.character(NVDRSall$Avg_Population)) / 3
NVDRSall <- NVDRSall %>%
mutate_at(vars(Avg_Population), funs(round(., 0)))
kable(NVDRSall, caption = "State Intimate Partner Homicide Rates by a Firearm (2017-2019)") %>%
kable_styling() %>%
scroll_box(width = "900px", height = "500px")
| State | 2017_Deaths | 2017_Population | 2017_Crude_Rate | 2018_Deaths | 2018_Population | 2018_Crude_Rate | 2019_Deaths | 2019_Population | 2019_Crude_Rate | Total_Deaths | Avg_Population | Avg_Crude_Rate |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Alaska | –* | 739795 | –* | –* | 737438 | –* | –* | 731545 | –* | 14* | 736259 | 0.63* |
| Arizona | 25 | 7016270 | 0.36 | 27 | 7171646 | 0.38 | 32 | 7278717 | 0.44 | 84 | 7155544 | 0.39 |
| California | 26 | 11917896 | 0.22 | 57 | 21362199 | 0.27 | 34 | 22513766 | 0.15 | 117 | 18597954 | 0.21 |
| Colorado | –* | 5607154 | –* | 17* | 5695564 | 0.30* | 21 | 5758736 | 0.36 | –** | 5687151 | –** |
| Connecticut | –* | 3588184 | –* | –* | 3572665 | –* | –* | 3565287 | –* | 15* | 3575379 | 0.14* |
| Delaware | –* | 961939 | –* | –* | 967171 | –* | –* | 973764 | –* | 10* | 967625 | 0.34* |
| Georgia | 49 | 10429379 | 0.47 | 51 | 10519475 | 0.48 | 49 | 10617423 | 0.46 | 149 | 10522092 | 0.47 |
| Illinois | 24 | 10149280 | 0.24 | 25 | 10962819 | 0.23 | 19* | 11409362 | 0.17* | 68 | 10840487 | 0.21 |
| Indiana | 17* | 6666818 | 0.25* | 24 | 6691878 | 0.36 | 16* | 6732219 | 0.24* | 57 | 6696972 | 0.28 |
| Iowa | –* | 3145711 | –* | –* | 3156145 | –* | –* | 3155070 | –* | 12* | 3152309 | 0.13* |
| Kansas | 12* | 2913123 | 0.41* | 15* | 2911505 | 0.52* | –* | 2913314 | –* | –** | 2912647 | –** |
| Kentucky | 25 | 4454189 | 0.56 | 27 | 4468402 | 0.60 | 18* | 4467673 | 0.40* | 70 | 4463421 | 0.52 |
| Maine | –* | 1335907 | –* | –* | 1338404 | –* | –* | 1344212 | –* | 13* | 1339508 | 0.32* |
| Maryland | –* | 6052177 | –* | 17* | 6042718 | 0.28* | 10* | 6045680 | 0.17* | –** | 6046858 | –** |
| Massachusetts | –* | 6859819 | –* | 10* | 6902149 | 0.14* | –* | 6892503 | –* | 19* | 6884824 | 0.09* |
| Michigan | 28 | 9962311 | 0.28 | 43 | 9995915 | 0.43 | 38 | 9986857 | 0.38 | 109 | 9981694 | 0.36 |
| Minnesota | 10* | 5576606 | 0.18* | –* | 5611179 | –* | –* | 5639632 | –* | 22 | 5609139 | 0.13 |
| Nevada | 12* | 2998039 | 0.40* | 20* | 3034392 | 0.66* | 18* | 3080156 | 0.58* | 50 | 3037529 | 0.55 |
| New Hampshire | –* | 1342795 | –* | –* | 1356458 | –* | –* | 1359711 | –* | 10* | 1352988 | 0.25* |
| New Jersey | 13* | 9005644 | 0.14* | –* | 8908520 | –* | –* | 8882190 | –* | 27 | 8932118 | 0.10 |
| New Mexico | 12* | 2088070 | 0.57* | 11* | 2095428 | 0.52* | 16* | 2096829 | 0.76* | 39 | 2093442 | 0.62 |
| North Carolina | 53 | 10273419 | 0.52 | 44 | 10383620 | 0.42 | 38 | 10488084 | 0.36 | 135 | 10381708 | 0.43 |
| Ohio | 52 | 11658609 | 0.45 | 40 | 11689442 | 0.34 | 41 | 11689100 | 0.35 | 133 | 11679050 | 0.38 |
| Oklahoma | 29 | 3930864 | 0.74 | 26 | 3943079 | 0.66 | 33 | 3956971 | 0.83 | 88 | 3943638 | 0.74 |
| Oregon | 16* | 4142776 | 0.39* | 11* | 4190713 | 0.26* | –* | 4217737 | –* | –** | 4183742 | –** |
| Pennsylvania | 37 | 10461388 | 0.35 | 22 | 10524784 | 0.21 | 33 | 10621092 | 0.31 | 92 | 10535755 | 0.29 |
| Rhode Island | 0 | 1059639 | 0.00* | –* | 1057315 | –* | –* | 1059361 | –* | –* | 1058772 | –* |
| South Carolina | 26 | 5024369 | 0.52 | 28 | 5084127 | 0.55 | 34 | 5148714 | 0.66 | 88 | 5085737 | 0.58 |
| Utah | –* | 3101833 | –* | –* | 3161105 | –* | –* | 3205958 | –* | 12* | 3156299 | 0.13* |
| Vermont | 0 | 623657 | 0.00* | –* | 626299 | –* | –* | 623989 | –* | –* | 624648 | –* |
| Virginia | 36 | 8470020 | 0.43 | 33 | 8517685 | 0.39 | 29 | 8535519 | 0.34 | 98 | 8507741 | 0.38 |
| Washington | 18* | 7071935 | 0.25* | 17* | 7535591 | 0.23* | 24 | 7614893 | 0.32 | 59 | 7407473 | 0.27 |
| West Virginia | 12* | 1815857 | 0.66* | –* | 1805832 | –* | 16* | 1792147 | 0.89* | –** | 1804612 | –** |
| Wisconsin | 16* | 5795483 | 0.28* | 13* | 5813568 | 0.22* | 23 | 5822434 | 0.40 | 52 | 5810495 | 0.30 |
–* The number of deaths fewer than 10; the number has been suppressed to retain confidentiality
–** State-level counts and rates based on fewer than 10 deaths have been suppressed to retain confidentiality
URL <- "https://www.disarmdv.org/state/"
State <- c('alabama', 'alaska', 'arizona', 'arkansas', 'california', 'colorado', 'connecticut', 'delaware', 'florida', 'georgia', 'hawaii', 'idaho', 'illinois', 'indiana', 'iowa', 'kansas', 'kentucky', 'louisiana', 'maine', 'maryland', 'massachusetts', 'michigan', 'minnesota', 'mississippi', 'missouri', 'montana', 'nebraska', 'nevada', 'new-hampshire', 'new-jersey', 'new-mexico', 'new-york', 'north-carolina', 'north-dakota', 'ohio', 'oklahoma', 'oregon', 'pennsylvania', 'rhode-island', 'south-carolina', 'south-dakota', 'tennessee', 'texas', 'utah', 'vermont', 'virginia', 'washington', 'west-virginia', 'wisconsin', 'wyoming')
URLS <- URL
# loop through the States
for (i in 1:length(State)){
URLS <- c(URLS, paste("https://www.disarmdv.org/state/", State[i], sep = ""))
}
head(URLS)
[1] "https://www.disarmdv.org/state/"
[2] "https://www.disarmdv.org/state/alabama"
[3] "https://www.disarmdv.org/state/alaska"
[4] "https://www.disarmdv.org/state/arizona"
[5] "https://www.disarmdv.org/state/arkansas"
[6] "https://www.disarmdv.org/state/california"
[1] "https://www.disarmdv.org/state/alabama/?sec=law"
[2] "https://www.disarmdv.org/state/alaska/?sec=law"
[3] "https://www.disarmdv.org/state/arizona/?sec=law"
[4] "https://www.disarmdv.org/state/arkansas/?sec=law"
[5] "https://www.disarmdv.org/state/california/?sec=law"
[6] "https://www.disarmdv.org/state/colorado/?sec=law"
disarmdv <- c()
css_selector <- ".auto-navigation-content"
for (i in 1:length(StateURL)){
laws <- StateURL[i] %>%
read_html() %>%
html_nodes(css = css_selector) %>%
html_text()
disarmdv <- c(disarmdv, laws)
}
# look at first 2 states' legal info
kable(disarmdv[1:2]) %>%
kable_styling()
| x |
|---|
| Alabama Law ALABAMA DOMESTIC VIOLENCE FIREARM PROHIBITIONS Alabama Domestic Violence Firearm Purchase and Possession Prohibitions Alabama prohibits the following individuals from owning a firearm, possessing a firearm, or having a firearm in their control: Persons convicted of a misdemeanor offense of domestic violence; and Persons subject to a valid protection order for domestic abuse.1 “Valid protection order” is defined as “an order issued after a hearing of which the person received actual notice, and at which the person had an opportunity to participate, that does any of the following: Restrains the person from harassing, stalking, or threatening a qualified individual* or child of the qualified individual or person or engaging in other conduct that would place a qualified individual in reasonable fear of bodily injury to the individual or child and that includes a finding that the person represents a credible threat to the physical safety of the qualified individual or child. By its terms, explicitly prohibits the use, attempted use, or threatened use of physical force against the qualified individual or child that would reasonably be expected to cause bodily injury.”2 ALABAMA CIVIL PROTECTION ORDER FIREARM REMOVAL Domestic Violence Civil Protection Orders That Require Firearm Removal Alabama law does not require the removal of firearms from persons subject to domestic violence protection orders. Alabama law does allow a judge issuing an ex parte protection order, an ex parte modification of a protection order, a final protection order, or a modification of a protection order issued after notice and hearing to “[o]rder other relief as it deems necessary to provide for the safety and welfare of the plaintiff or any children and any person designated by the court.”3 Individuals Who May Petition for a Protection Order The following persons may petition for a protection order: A spouse (including a common law spouse); A former spouse (including a common law former spouse); A person with whom the defendant has a child in common, regardless of whether the victim or defendant have ever been married and regardless of whether they are currently residing or have in the past resided together in the same household; A person who has or had a dating relationship with the defendant; A person who is or was cohabiting with the defendant and who is in, or was engaged in, a romantic or sexual relationship with the defendant; A relative of a person defined in (e) who also lived with the defendant; or An individual who is a parent, stepparent, child, or stepchild and who is in or has maintained a living arrangement with the defendant.4 Penalties for Violation A violation of a protective order is a Class A misdemeanor.5 |
| Alaska Law DOMESTIC VIOLENCE FIREARM PROHIBITIONS Alaska Domestic Violence Firearm Purchase and Possession Prohibitions Alaska may prohibit the person subject to a protective order issued after notice and a hearing at which the respondent had the right to appear and be heard from “using or possessing a deadly weapon if the court finds the respondent was in the actual possession of or used a weapon during the commission of domestic violence[.]”1 Alaska does not prohibit firearm purchase and possession by: Persons convicted of domestic violence misdemeanors; Persons subject to an ex parte domestic violence protective order. CIVIL PROTECTIVE ORDER FIREARM REMOVAL Domestic Violence Civil Protective Orders That Require Firearm Removal Alaska law does not require the removal of firearms from persons subject to domestic violence protective orders; however, a court issuing a domestic violence protective order, after notice and a hearing at which the respondent had the right to appear and be heard, may “direct the respondent to surrender any firearm owned or possessed by the respondent if the court finds that the respondent was in the actual possession of or used a firearm during the commission of the domestic violence[.]”2 Individuals Who May Petition for a Protective Order A “household member” may petition for a protective order. “Household member” includes: Adults or minors who are current or former spouses; Adults or minors who live together or who have lived together; Adults or minors who are dating or who have dated; Adults or minors who are engaged in or who have engaged in a sexual relationship; Adults or minors who are related to each other up to the fourth degree of consanguinity, whether of the whole or half blood or by adoption, computed under the rules of civil law; Adults or minors who are related or formerly related by marriage; Persons who have a child of the relationship; and Minor children of a person in a relationship that is described in (A)-(G) of this paragraph[.]3 Removal Process A court issuing a domestic violence protective order may “direct the respondent to surrender any firearm owned or possessed by the respondent” but does not specify a time frame in which to comply nor does it specify to whom firearms should be surrendered.4 Return of Firearms to Respondent Alaska law does not specify how firearms are returned to the respondent at the termination or expiration of a domestic violence protective order. Penalties for Violation A violation of a protective order may be a misdemeanor “punishable by up to one year of incarceration and up to a $25,000 fine[.]”5 |
Corpus consisting of 50 documents, showing 50 documents:
Text Types Tokens Sentences
text1 207 498 5
text2 186 481 8
text3 191 503 7
text4 138 232 5
text5 495 1735 22
text6 263 1016 5
text7 320 1281 3
text8 435 1533 14
text9 276 797 8
text10 126 225 4
text11 241 625 5
text12 155 332 5
text13 380 1378 8
text14 184 472 6
text15 235 670 6
text16 188 408 3
text17 251 620 7
text18 482 2087 22
text19 390 1423 6
text20 259 991 11
text21 359 1329 7
text22 266 708 7
text23 440 1706 4
text24 185 397 3
text25 160 329 5
text26 196 528 5
text27 171 359 3
text28 254 972 5
text29 377 1348 27
text30 270 1170 12
text31 380 1325 14
text32 444 1746 10
text33 416 1637 24
text34 265 643 4
text35 298 853 9
text36 265 782 8
text37 246 684 5
text38 629 3547 65
text39 392 1509 8
text40 176 470 2
text41 219 610 6
text42 261 761 3
text43 233 660 4
text44 254 834 4
text45 376 1223 9
text46 278 880 7
text47 506 2380 16
text48 340 1324 11
text49 452 2125 15
text50 179 396 6
laws_tokens <- tokens(laws_corpus, remove_punct = TRUE)
laws_tokens
Tokens consisting of 50 documents.
text1 :
[1] "Alabama" "Law" "ALABAMA" "DOMESTIC"
[5] "VIOLENCE" "FIREARM" "PROHIBITIONS" "Alabama"
[9] "Domestic" "Violence" "Firearm" "Purchase"
[ ... and 436 more ]
text2 :
[1] "Alaska" "Law" "DOMESTIC" "VIOLENCE"
[5] "FIREARM" "PROHIBITIONS" "Alaska" "Domestic"
[9] "Violence" "Firearm" "Purchase" "and"
[ ... and 420 more ]
text3 :
[1] "Arizona" "Law" "DOMESTIC" "VIOLENCE"
[5] "FIREARM" "PROHIBITIONS" "Arizona" "Domestic"
[9] "Violence" "Firearm" "Purchase" "and"
[ ... and 437 more ]
text4 :
[1] "Arkansas" "Law" "DOMESTIC" "VIOLENCE"
[5] "FIREARM" "PROHIBITIONS" "Arkansas" "Domestic"
[9] "Violence" "Firearm" "Purchase" "and"
[ ... and 197 more ]
text5 :
[1] "California" "Law" "DOMESTIC" "VIOLENCE"
[5] "FIREARM" "PROHIBITIONS" "California" "Domestic"
[9] "Violence" "Firearm" "Purchase" "and"
[ ... and 1,569 more ]
text6 :
[1] "Colorado" "Law" "DOMESTIC" "VIOLENCE"
[5] "FIREARM" "PROHIBITIONS" "Colorado" "Domestic"
[9] "Violence" "Firearm" "Purchase" "and"
[ ... and 904 more ]
[ reached max_ndoc ... 44 more documents ]
laws_dfm <- dfm(laws_tokens)
docnames(laws_dfm) <- c('alabama', 'alaska', 'arizona', 'arkansas', 'california', 'colorado', 'connecticut', 'delaware', 'florida', 'georgia', 'hawaii', 'idaho', 'illinois', 'indiana', 'iowa', 'kansas', 'kentucky', 'louisiana', 'maine', 'maryland', 'massachusetts', 'michigan', 'minnesota', 'mississippi', 'missouri', 'montana', 'nebraska', 'nevada', 'new-hampshire', 'new-jersey', 'new-mexico', 'new-york', 'north-carolina', 'north-dakota', 'ohio', 'oklahoma', 'oregon', 'pennsylvania', 'rhode-island', 'south-carolina', 'south-dakota', 'tennessee', 'texas', 'utah', 'vermont', 'virginia', 'washington', 'west-virginia', 'wisconsin', 'wyoming')
laws_dfm
Document-feature matrix of: 50 documents, 2,238 features (88.84% sparse) and 0 docvars.
features
docs alabama law domestic violence firearm prohibitions
alabama 7 5 6 5 7 2
alaska 0 4 11 11 8 2
arizona 0 3 7 7 10 2
arkansas 0 2 4 4 4 2
california 0 19 10 12 42 2
colorado 0 9 6 6 18 2
features
docs purchase and possession prohibits
alabama 1 10 1 2
alaska 2 8 4 0
arizona 1 4 1 2
arkansas 1 1 1 0
california 2 18 8 1
colorado 1 7 9 1
[ reached max_ndoc ... 44 more documents, reached max_nfeat ... 2,228 more features ]
laws_dfm2 <- tokens(laws_corpus,
remove_punct= TRUE,
remove_numbers = TRUE) %>%
tokens_tolower() %>%
tokens_select(pattern=stopwords("en"),
selection="remove") %>%
dfm()
docnames(laws_dfm2) <- c('alabama', 'alaska', 'arizona', 'arkansas', 'california', 'colorado', 'connecticut', 'delaware', 'florida', 'georgia', 'hawaii', 'idaho', 'illinois', 'indiana', 'iowa', 'kansas', 'kentucky', 'louisiana', 'maine', 'maryland', 'massachusetts', 'michigan', 'minnesota', 'mississippi', 'missouri', 'montana', 'nebraska', 'nevada', 'new-hampshire', 'new-jersey', 'new-mexico', 'new-york', 'north-carolina', 'north-dakota', 'ohio', 'oklahoma', 'oregon', 'pennsylvania', 'rhode-island', 'south-carolina', 'south-dakota', 'tennessee', 'texas', 'utah', 'vermont', 'virginia', 'washington', 'west-virginia', 'wisconsin', 'wyoming')
textplot_wordcloud(laws_dfm2, max_words = 50)
topfeatures(laws_dfm2, 30)
order firearm firearms domestic violence
1007 596 564 503 452
protection court person may respondent
433 403 364 346 326
protective shall law persons ammunition
322 311 309 302 288
abuse possession party defendant subject
263 255 206 194 181
removal family child enforcement surrender
174 162 155 152 145
weapons possessing household orders member
145 143 142 141 131
textstat_frequency(laws_dfm2, n=20)
feature frequency rank docfreq group
1 order 1007 1 50 all
2 firearm 596 2 50 all
3 firearms 564 3 50 all
4 domestic 503 4 50 all
5 violence 452 5 50 all
6 protection 433 6 36 all
7 court 403 7 50 all
8 person 364 8 45 all
9 may 346 9 50 all
10 respondent 326 10 31 all
11 protective 322 11 23 all
12 shall 311 12 35 all
13 law 309 13 50 all
14 persons 302 14 50 all
15 ammunition 288 15 39 all
16 abuse 263 16 28 all
17 possession 255 17 50 all
18 party 206 18 19 all
19 defendant 194 19 17 all
20 subject 181 20 48 all
It is important to note that domestic violence does appear in each of the 50 documents (states), BUT that does not mean the state has any domestic violence related firearm provisions. For example, the text for Missouri (below) says “Missouri does not prohibit purchase and possession of firearms or ammunition by persons convicted of misdemeanor crimes of domestic violence”. First, I’ll want to determine which states do and don’t have relevant provisions before diving more into the specific provisions and language used.
kable(disarmdv[25]) %>%
kable_styling()
| x |
|---|
| Missouri Law Missouri Domestic Violence Firearm Purchase and Possession Prohibitions Missouri does not prohibit purchase and possession of firearms or ammunition by persons convicted of misdemeanor crimes of domestic violence. Missouri does not prohibit purchase and possession of firearms or ammunition by persons subject to orders of protection. MISSOURI DOMESTIC VIOLENCE ORDER OF PROTECTION FIREARM REMOVAL Civil Domestic Violence Orders of Protection that Require Removal Missouri does not require removal of firearms or ammunition from subjects of domestic violence orders of protection; however, a court issuing an ex parte or final domestic violence order of protection may “include such terms as the court reasonably deems necessary to ensure the petitioner’s safety” that includes a non-exhaustive list of relief.1 Individuals Who May Petition for a Domestic Violence Order of Protection Any person who has been subject to domestic violence by a present or former family or household member may petition for a domestic violence order of protection.2 “Domestic violence” is defined as “abuse or stalking committed by a family or household member.”3 “Abuse” is defined to include, but is not limited to, “the occurrence of any of the following acts, attempts or threats against a person who may be protected pursuant to” Missouri law: Assault; Battery; Coercion; Harassment; Sexual assault; Unlawful imprisonment.4 “Family or household member” includes: Spouses; Former spouses; Any person related by blood or marriage; Persons who are presently residing together or have resided together in the past; Any person who is or has been in a continuing social relationship of a romantic or intimate nature with the victim; and Anyone who has a child in common regardless of whether they have been married or have resided together at any time.5 |
Some provisions that research has indicated may be important to influencing the protectiveness of domestic-violence-related firearm measures have to do with the removal process of weapons. Key words may be “removal”, “removed”, “removing”. I’ll take the word stems and see how frequent “remov” occurs in each document (state).
laws_stems <- tokens(laws_corpus,
remove_punct= TRUE,
remove_numbers = TRUE) %>%
tokens_tolower() %>%
tokens_select(pattern=stopwords("en"),
selection="remove") %>%
tokens_wordstem() %>%
dfm()
docnames(laws_stems) <- c('alabama', 'alaska', 'arizona', 'arkansas', 'california', 'colorado', 'connecticut', 'delaware', 'florida', 'georgia', 'hawaii', 'idaho', 'illinois', 'indiana', 'iowa', 'kansas', 'kentucky', 'louisiana', 'maine', 'maryland', 'massachusetts', 'michigan', 'minnesota', 'mississippi', 'missouri', 'montana', 'nebraska', 'nevada', 'new-hampshire', 'new-jersey', 'new-mexico', 'new-york', 'north-carolina', 'north-dakota', 'ohio', 'oklahoma', 'oregon', 'pennsylvania', 'rhode-island', 'south-carolina', 'south-dakota', 'tennessee', 'texas', 'utah', 'vermont', 'virginia', 'washington', 'west-virginia', 'wisconsin', 'wyoming')
laws_stems %>%
dfm_select("remov") %>%
convert(to = "data.frame")
doc_id remov
1 alabama 3
2 alaska 4
3 arizona 4
4 arkansas 3
5 california 5
6 colorado 4
7 connecticut 4
8 delaware 5
9 florida 6
10 georgia 3
11 hawaii 4
12 idaho 3
13 illinois 3
14 indiana 4
15 iowa 4
16 kansas 3
17 kentucky 3
18 louisiana 3
19 maine 4
20 maryland 3
21 massachusetts 5
22 michigan 3
23 minnesota 5
24 mississippi 3
25 missouri 3
26 montana 3
27 nebraska 3
28 nevada 4
29 new-hampshire 7
30 new-jersey 7
31 new-mexico 4
32 new-york 3
33 north-carolina 4
34 north-dakota 4
35 ohio 3
36 oklahoma 3
37 oregon 3
38 pennsylvania 3
39 rhode-island 3
40 south-carolina 3
41 south-dakota 3
42 tennessee 3
43 texas 3
44 utah 3
45 vermont 3
46 virginia 2
47 washington 4
48 west-virginia 3
49 wisconsin 4
50 wyoming 3
What about which states use “shall” versus “may” in their wording…
laws_shall <- laws_dfm2 %>%
dfm_select("shall") %>%
convert(to = "data.frame")
laws_may <- laws_dfm2 %>%
dfm_select("may") %>%
convert(to = "data.frame")
data.frame(laws_shall, laws_may[2])
doc_id shall may
1 alabama 0 2
2 alaska 0 6
3 arizona 3 5
4 arkansas 0 3
5 california 16 17
6 colorado 9 8
7 connecticut 7 8
8 delaware 11 11
9 florida 1 5
10 georgia 0 4
11 hawaii 3 5
12 idaho 1 4
13 illinois 8 6
14 indiana 0 6
15 iowa 5 2
16 kansas 0 3
17 kentucky 2 7
18 louisiana 26 11
19 maine 4 6
20 maryland 2 9
21 massachusetts 14 9
22 michigan 6 10
23 minnesota 17 12
24 mississippi 0 5
25 missouri 0 4
26 montana 3 5
27 nebraska 2 4
28 nevada 0 7
29 new-hampshire 13 13
30 new-jersey 11 8
31 new-mexico 12 7
32 new-york 13 13
33 north-carolina 11 7
34 north-dakota 0 4
35 ohio 2 5
36 oklahoma 9 8
37 oregon 2 2
38 pennsylvania 35 13
39 rhode-island 8 8
40 south-carolina 0 1
41 south-dakota 0 6
42 tennessee 3 6
43 texas 2 7
44 utah 0 8
45 vermont 6 7
46 virginia 0 8
47 washington 8 10
48 west-virginia 18 4
49 wisconsin 18 14
50 wyoming 0 3