Figure shows the predictive words and medical coder abbreviations from the Lasso regression model fitted on shared words with term frequency-inverse document frequency normalization. Some duplication was present because of words used by the coders (ie, “accidently” and “accidentally”).
Error bars indicate the 95% CIs.
eFigure 1. Study Flow Diagram
eTable 1. Nonfatal Gun Injury Location Categories and Recoded Prediction Category
eTable 2. Hospital Probability Sampling Unit Estimate Imputations
eTable 3. Wounded Individual Characteristics, Circumstances, Injury and Disposition by Missing and Non-Missing Location Data
eFigure 2. Comparison of NLP Predictors Rank by Missing and Non-Missing Location Data
eTable 4. Spearman Correlation between NLP Predictors Rank by Missing and Non-Missing Location Data
eTable 5. Misclassification Errors by Best-performing Model
eTable 6. Predicted Missing Gun Injury Locations by Model Type
eTable 7. Comparison of National Estimates of Non-Fatal Shootings with NLP
Customize your JAMA Network experience by selecting one or more topics from the list below.
Identify all potential conflicts of interest that might be relevant to your comment.
Conflicts of interest comprise financial interests, activities, and relationships within the past 3 years including but not limited to employment, affiliation, grants or funding, consultancies, honoraria or payment, speaker's bureaus, stock ownership or options, expert testimony, royalties, donation of medical equipment, or patents planned, pending, or issued.
Err on the side of full disclosure.
If you have no conflicts of interest, check "No potential conflicts of interest" in the box below. The information will be posted with your response.
Not all submitted comments are published. Please see our commenting policy for details.
Parker ST. Estimating Nonfatal Gunshot Injury Locations With Natural Language Processing and Machine Learning Models. JAMA Netw Open. 2020;3(10):e2020664. doi:10.1001/jamanetworkopen.2020.20664
Can natural language processing and machine learning methods be used to predict the locations of nonfatal shootings and improve the accuracy of existing national estimates of these gunshot injuries?
This cross-sectional study of 22 years of data from the National Electronic Injury Surveillance System Firearm Injury Surveillance Study used natural language processing of unstructured medical text combined with machine learning models to classify the location of nonfatal gunshot injuries. Contrary to existing national estimates of these injuries that indicate they occur most often in homes, this analysis found that these injuries occur most often in the street or highway.
Natural language processing and machine learning may be used to predict gunshot injury locations, and this information could be used to improve the accuracy of existing national estimates of these locations and to inform future firearm injury prevention efforts.
Nonfatal gunshot injuries are the most common firearm injury, but where they frequently occur remains unclear owing to data limitations. Natural language processing can be applied to medical text narratives of gunshot injury records to classify injury location and inform prevention efforts.
To examine the performance of natural language processing (NLP) and machine learning models to predict nonfatal gunshot injury locations and generate new national estimates of the locations in which these injuries occur.
Design, Setting, and Participants
Cross-sectional study of data from the National Electronic Injury Surveillance System Firearm Injury Surveillance Study on nonfatal gunshot injuries that occurred in the US between January 1, 1993, and December 31, 2015. The unweighted sample included 59 025 gunshot injuries that were initially treated at emergency departments. Data were analyzed from June 1, 2019 to July 24, 2020.
Main Outcomes and Measures
The primary outcomes were classification of injury location and subsequent estimation of nonfatal gunshot injury location. The NLP was used to generate 6 sets of predictors, and 4 machine learning models were trained to classify the missing locations: multinomial support vector machines, lasso regression, XgBoost gradient descent, and feed-forward neural networks. For each of the 6 sets of NLP predictors, 70% of records with locations were randomly sampled to form the training set and the remaining 30% of records composed the test set. The best-performing model was validated by comparing the predicted locations were with those from existing national estimates of nonfatal gunshot injuries stratified by location and intent.
The unweighted sample included 59 025 nonfatal gunshot injuries; patients with these injuries were predominantly male (n = 52 630, [89.2%]), of Black race/ethnicity (n = 29 304 [49.6%]), and young (15-24 years; n = 27 037 [45.8%]). In total, 54 089 nonfatal gunshot injuries that were weighted to approximate national estimates were included in the analysis. Existing national estimates suggest that the most prevalent nonfatal gunshot injury location is the home (n = 14 764 [23.4%]), followed by the street or highway (n = 14 402 [22.9%]), and other public places (n = 7276 [11.6%]). After implementation of NLP classification, the most frequent gunshot injury location was the street or highway (n = 27 200 [46.1%]), followed by the home (n = 23 738 [37.7%]), and other public places (n = 10 439 [15.1%]).
Conclusions and Relevance
The findings of this study suggest that NLP and machine learning models may be useful for classifying gunshot injury location and that most nonfatal gunshot injuries occur in the street or highway rather than in the home; these findings can inform future firearm injury prevention efforts.
Firearms are a leading cause of injury in the United States.1 Understanding where gunshot injuries occur is relevant for prevention, particularly prevention of nonfatal gunshot injuries, which occur 5 times more often than fatal gunshot injuries.2 However, information on the location of nonfatal firearm injury is frequently missing from national data sources. Localized studies of gunshot injuries3-6 vary in their assessment of the places where nonfatal injuries occur and prevention focus and are often limited owing to missing or imprecise data on the place where the injury occurred. Some studies have found that nonfatal gunshot injuries occur in a patient’s home and have suggested a focus on injury prevention in the home or in geographically proximate, concentrated areas.3,4 Other studies have used more precise location data and have found that gunshot injuries are less likely to occur in proximity to the patient’s residence, potentially owing to neighborhood factors and social ties.5,6 The limits of existing national data on nonfatal gunshot injuries have resulted in uncertainty about injury prevention efforts and the risks associated with firearms. Without accurate estimates of where nonfatal gunshot injuries most frequently occur, prevention efforts lack important data.
In this cross-sectional study, natural language processing (NLP) methods used unstructured medical text combined with machine learning models to predict the location where nonfatal gunshot injuries occur. Using unstructured medical text data from a national sample of nonfatal gunshot injuries, the location predictions were compared across different algorithms and NLP predictors. The predicted locations generated with NLP predictors and machine learning models were compared with existing locations from a national data source to reexamine the location of nonfatal gunshot injuries and intent patterns.
The institutional review board at the University of Michigan deemed this study exempt from review and waived the requirement for participant informed consent because the data cannot be tracked to a human subject. This study followed the Strengthening the Reporting of Observational Studies in Epidemiology (STROBE) reporting guideline. Data were analyzed from June 1, 2019 to July 24, 2020.
Data used in this analysis were obtained from the National Electronic Injury Surveillance System (NEISS) Firearm Injury Surveillance Study (FISS), which included emergency department visits for gunshot injuries that occurred between January 1, 1993, and December 31, to 2015.6 The NEISS-FISS generates national estimates of nonfatal gunshot injuries from a probability sample of approximately 100 US emergency departments.7 The data are gathered and validated by medical coders through a Centers for Disease Control and Prevention partnership with the Consumer Product Safety Commission to supplement product safety injury surveillance with firearm injury surveillance. Although the location of injury is included in the NEISS-FISS data, almost half of the locations where gun injuries occur are not coded (eTable 1 in the Supplement). The NEISS-FISS also collects rich, unstructured medical narratives that document the circumstance of every gunshot injury.
The study sample included all nonfatal gunshot injuries documented in NEISS-FISS that occurred between January 1, 1993, and December 31, to 2015. BB-gun injuries and injuries that are not gunshot wounds were excluded (n = 59 025). A study flow diagram documenting the sample is shown in eFigure 1 in the Supplement.
The NEISS-FISS received public attention for inaccurate estimates that suggested a misleading increase in nonfatal gunshot injuries.8,9 Researchers documented the sources of the problematic estimates, and found that the pattern originated from 2 sources.10 The first source was hospital replacement within the NEISS-FISS sample. Hospitals that handled few gunshot injuries were occasionally replaced with hospitals that handled a high volume of gunshot injuries. The second source was improvement in coding of injuries over time. Taken together, these changes suggested a false increase in national estimates of nonfatal gun injuries. To account for these issues, this analysis reports on national estimates informed by corrections suggested in Cook et al.10 Three influential, high-volume hospital replacements were imputed to prior year levels in this analysis (eTable 2 in the Supplement).
The NEISS-FISS sample contains 9 labeled location categories, but some categories were reclassified to improve their generalizability for injury prevention and prediction. Location categories, such as a gunshot injury that occurred on a farm or the difference between an apartment and a house, were not feasible to predict because these categories each represent less than 1% of the injury data locations (see eTable 1 in the Supplement). In this analysis, nonfatal gunshot injuries were therefore classified as occurring in the following locations: (1) in a home or apartment, (2) in the street or highway, (3) other public place or (4) other. Other public place is an existing injury location code that was unaltered; it refers to injuries that occurred in public places such as stores and restaurants. Remaining injury location codes in the NEISS-FISS sample include recreation, industry, and school, and each of these categories comprise less than 2% of the nonfatal gunshot injuries (see eTable 1 in the Supplement). These cases were combined and recoded as Other in the predictive models.
Natural language processing of NEISS-FISS unstructured medical text was used to generate predictors to classify locations of nonfatal gunshot injuries. Each gunshot injury included in the NEISS-FISS contains a narrative describing the injury circumstances (eg, sex and age of the individual, primary body part affected, place where the injury occurred, and whether the individual was sitting or standing) compiled by trained medical coders.
Unique words that appeared in the medical narratives were identified and used to form predictors to indicate whether the word, or a combination of words, appeared in the narrative. To ensure that results were not driven by differences in medical text among records with missing vs nonmissing location data, the word predictors were applied to different samples and NLP modeling strategies. First, to assess the robustness of classification to selection in the test and training sets, 2 sets of NLP predictors were constructed using (1) shared words (n = 9528) in all records with missing and nonmissing location data and (2) all words (n = 15 358) in any record. Next, for each of the 2 sets of words, NLP predictors were generated to reduce dimensionality and generate meaningful features (eg, nightclub, arrest, intoxication, domestic). Term frequency-inverse document frequency (TF-IDF) weighting was used to weight the frequency of each individual word in the comments so that words that occurred frequently, such as shot, were downweighted vs words such as cleaning, which would provide additional information about the injury circumstances. Second, n-grams were used to create sequential word pairings as features with information about word sequencing. In addition, word embeddings (ie, a set of language modeling and feature learning techniques in NLP) was used to capture semantic relationships between words via the Global Vectors for Word Representation algorithm.11 Words that appeared less than 10 times or in less than 1% of the records were omitted.
Six sets of NLP features were used to train and evaluate 4 classification models. Classification models were selected for their suitability to avoid overfitting when selection existed between training and test sets and for regularization of wide feature sets. With sufficient training data, algorithms that are local learners, rather than global, can generate unbiased classification results even if the training data are subject to selection.12,13 Specifically, multinomial support vector machines (SVMs) and Lasso regression were selected for this reason along with XgBoost gradient descent and feed-forward neural networks.14
Model performance was assessed across 6 different NLP predictor constructions that varied both by word content and feature construction to ascertain whether the content, similarity, sequence, or frequency of predictors mattered for performance. For each of the 6 sets of NLP predictors, 70% of records with locations were randomly sampled to form the training set and the remaining 30% of records composed the test set. 5-fold cross-validation was used to fit each multinomial classification model to prevent overfitting. Predictions from each fitted model were applied to the test set to evaluate out-of-sample predictions by accuracy, precision, recall, and the area under the curve (AUC) of out-of-sample test set predictions by each location. Misclassification by location for the preferred each classifier model is reported described in eTable 5 in the Supplement. The preferred fitted model was applied to missing location data to classify where gunshot injuries occurred.
Descriptive statistics were used to compare missing vs nonmissing location data with respect to the severity and location of the injury, the demographic characteristics of the injured patients, the intent of the shooting, hospital, and other variables. Training, test, and missing location data were also compared. The words present in the narratives of records with missing and nonmissing location data were compared using 2-tailed, Spearman correlations of ranked word frequency to ascertain the magnitude of the differences between unstructured text in records with missing and nonmissing location data.15
Location predictions from the best-performing model were combined with NEISS-FISS sample case weights and existing records with nonmissing location data to generate national estimates of the locations of gunshot injuries. To account for increases in gunshot injuries in the national estimates that were attributable to hospital replacement, 3 probability sampling units with large replacement volumes were imputed to their prior year distribution in the most influential hospital sample replacements (eTable 2 in the Supplement). National estimates generated with predicted locations were compared with estimates without predicted locations or with the existing NEISS-FISS gunshot injury location estimates, using 2-sided χ2 tests. Using these combined locations from the best-performing model’s classification results, 95% CIs were bootstrapped using 500 replications of the preferred model predictions and the NEISS direct variance estimation procedures.16 Predicted locations were used to examine intent and the patient’s race and sex by location of injury.
Analyses were performed using R, version 3.4.3 (R Foundation for Statistical Computing) with the text2vec, glmnet, e1071 and nnet packages.17,18 The threshold for statistical significance was an an α level of .05.
Table 1 presents the characteristics of patients with nonfatal gunshot injuries between January 1, 1993, to December 31, 2015, as well as details about the affected body part, circumstances of the injury, and hospital attributes. The unweighted sample comprises 59 025 nonfatal gunshot injuries, of which victims were predominantly male (n = 52 630, [89.2%]), of Black race/ethnicity (n = 29 304 [49.6%]), and young (15-24 years; n = 27 037 [45.8%]), and the incident intent was assault (42 099 [71.3%]). Patients whose records were missing injury location data often were hospitalized, wounded in the upper trunk, and shot during an assault. The records with missing and nonmissing location data had different distributions across variables, including whether the injury occurred during a crime, the primary body part affected, and the victim’s age, but the records differ less by hospital stratum (eTable 3 in the Supplement). However, the NLP predictors that were shared between records with missing and nonmissing location data were correlated. Among the top 200 words in records with missing and nonmissing location data, 4 words were present in records with missing location and were not present in those with location data (eFigure 2 in the Supplement). The Spearman correlation between ranked words in each set of NLP predictors for the top 200 words was 0.92 (P < .001) and did not differ with rarer word occurrences (eTable 4 in the Supplement).
Table 2 describes the performance of each multinomial classification algorithm by NLP predictor set. Among classifiers (ie, home, street, public place, other) fitted on the set of all word NLP predictors, models fitted on TF-IDF predictors had the most accurate performance, specifically Lasso regression with all words and TF-IDF normalization (accuracy, 0.783) and SVM with TF-IDF normalization (accuracy, 0.747). Among classifiers fitted on the set of shared word NLP predictors, Lasso regression with TF-IDF (accuracy, 0.787) and SVM with TF-IDF (accuracy, 0.772) were most accurate both overall and among local classifiers. The accuracy loss between models fitted on the set of all words compared with shared words was 0.4% for Lasso regression and 2.5% for SVM models. Among all models, TF-IDF normalization and n-grams were more often associated with more accurate model performance rather than word embeddings. The shared words Lasso regression model with TF-IDF normalization correctly classified locations most frequently (81.9% of home locations, 72.9% of street or highway, 72.6% of public place gunshot injuries, and 73.2% of other locations). Misclassifications for this model were most often instances of incorrect classification of gunshot injuries that occurred in the street as other public place, in which 12.3% of street locations were misclassified as public place and 18.9% of public place locations were misclassified as street (eTable 5 in the Supplement). Predicted missing location data by each model and NLP predictor set are presented in eTable 6 in the Supplement. In the most accurate Lasso regression model trained on shared words, 30.0% of the missing location data were classified as having occurred in a home, 56.8% in the street or highway, 12.4% in public places and 0.8% in other locations.
Figure 1 plots predictive words from the Lasso regression model fitted on shared words with TF-IDF normalization that are influential in predicting the missing locations. Words are plotted by the magnitude of their fitted coefficient. For nonfatal gunshot injuries that occur in a home, terms reflecting relationships, such as husband and boyfriend, as well as self-harm are important predictors. Nonfatal gunshot injuries that occurred in public places were best predicted by terms including store, bar, and club. For nonfatal gunshot injury locations in streets or highways, words that reflect this location, such as street, car, and driving are predictive and terms such as assault are predictive of the incident intent.
Figure 2 shows weighted national estimates of nonfatal gunshot injury locations with NLP and without NLP predicted locations. Without classification of the records with missing location data, the largest category of weighted nonfatal gun injury locations was unknown (mean annual estimate, 29 029 [39.5%]; 95% CI, 13 095.0-44 961.0), followed by injuries in the home (mean annual estimate, 15 257 [23.4%]; 95% CI, 8543.9-21 969.5), injuries in the street or highway (mean annual estimate, 14 447 [22.9%]; 95% CI, 5525.4-23 368.9), and injuries in other public places (mean annual estimate, 7732 [11.6%]; 95% CI, 3801.9-11 662.8) (eTable 7 in the Supplement). With NLP and classification, street or highway was the most frequent gun injury location (mean annual estimate, 27 200 [43.6%]; 95% CI, 13 769.6-45 517.5), followed by injuries in the home (mean annual estimate, 23 738 [36.0%]; 95% CI, 14 335.2-34 656.5), injuries in other public places (mean annual estimate, 10 439 [15.1%]; 95% CI, 6061.7-18 337.5).
Table 3 reports weighted national estimates of nonfatal gunshot injury locations stratified by intent and victim sex and race. Within each location, the distributions with predicted locations were similar to those without predicted locations. Assault and unintentional injury remain fairly equally associated with injury in the home and victim race and sex also remain stable. For each location, victims were most likely to be Black individuals and to have endured assault.
This cross-sectional study used NLP (to generate predictors from unstructured medical narrative text) and machine learning models to accurately classify nonfatal gunshot injury locations to home, street or highway, public place, or other categories. Model performance did not appear to be influenced by selection among records with missing and non-missing location data when comparing NLP predictors and models across different specifications. Contrary to national estimates without predicted locations, in this study, nonfatal gunshot injuries occurred most frequently in the street or highway rather than in homes. Among nonfatal gunshot injuries that occur in the home, predicted locations suggested that, in terms of incident intent, assault is as likely as unintentional injury.
This study has several limitations. Although the machine learning models reduced misleading missing location data from nonfatal gunshot injury records, they do not correct for large SEs from the relatively small NEISS-FISS hospital sample. Caution should be used in interpreting NEISS-FISS patterns over time because of imprecise estimates that have been shown to be sensitive to hospital sample inclusion. Efforts to account for these sample problems have been implemented by adjusting the national estimates presented. Second, selection in the training data could be a source of bias in predicted locations. Efforts to minimize selection in predicted locations included the use of machine learning models that were robust to selection and the use of features independent of information present in only the missing or non-missing training set. The existing ordering without predicted locations of where nonfatal gunshot injuries occurred was not preserved in any model; however, it is possible that classification or misclassification of location was still associated with hospital attributes that result in the missing location codes. In addition, not all records with missing location data could be verified using only NEISS-FISS medical text.
Contrary to existing national estimates of where nonfatal gunshot injuries most frequently occur, the findings of this cross-sectional study, which used NLP and machine learning models to predict these locations, suggest that nonfatal gunshot injuries occur more often in the street or highway rather than in homes. Where a nonfatal gunshot injury occurs helps to inform firearm injury prevention efforts, and the medical narratives included in the records from the NEISS-FISS offer valuable insight into injury location when combined with natural language processing techniques.
Accepted for Publication: August 4, 2020.
Published: October 14, 2020. doi:10.1001/jamanetworkopen.2020.20664
Open Access: This is an open access article distributed under the terms of the CC-BY License. © 2020 Parker ST. JAMA Network Open.
Corresponding Author: Susan T. Parker, MPP, MS, University of Michigan School of Public Health, 1415 Washington Heights, SPH II, Rm M3148, Ann Arbor, MI 48109 (firstname.lastname@example.org).
Author Contributions: Ms Parker had full access to all of the data in the study and takes responsibility for the integrity of the data and the accuracy of the data analysis.
Concept and design: Parker.
Acquisition, analysis, or interpretation of data: Parker.
Drafting of the manuscript: Parker.
Critical revision of the manuscript for important intellectual content: Parker.
Statistical analysis: Parker.
Conflict of Interest Disclosures: None reported.
Additional Contributions: This work benefited from guidance from Edward C. Norton, PhD, Andrew M. Ryan, PhD, and Jeffrey McCullough, PhD, Department of Health Management and Policy, University of Michigan; and Philip J. Cook, PhD, Sanford School of Public Policy, Duke University; they did not receive compensation for their contributions.
Create a personal account or sign in to: