Introduction

We used the Vermont State Police traffic stop data from 2021. The data set contains extensive information about every stop made in 2021. We focused on the reason for the stop (Reason), the action taken (Action), the outcome (Outcome), agency involved (Agency), age of the operator (Age), and the vehicle make and model (Vehicle_Make and Vehicle_Model). Our goal is to determine which variables, if any, are most helpful in predicting whether the Outcome of a traffic stop led to an arrest or not. We coded the Outcome as 1 for Arrest and 0 for Non-Arrest. Using a combination of graphs and machine learning methods, we explored our data with the intent of coming to some evidence based conclusions that answer our research question: How does the outcome of the traffic stop change based on the action taken, reason for the stop, agency involved, age of the operator, and the vehicle make and model?

Cleaning the data

## # A tibble: 9,064 × 10
##    Agency    Reason Action Outcome   Age Race  Gender Vehicle_Make Vehicle_Model
##    <chr>     <chr>  <chr>    <dbl> <int> <chr> <chr>  <chr>        <chr>        
##  1 Rutland   Movin… No Se…       1    38 W     F      FORD         TRUCK        
##  2 Rutland   Vehic… No Se…       0    51 W     F      CHEV         SILVERAD     
##  3 Shaftsbu… Movin… No Se…       0    20 W     F      TOYT         CAM          
##  4 Derby     Movin… No Se…       0    41 W     F      SUBA         CTK          
##  5 Shaftsbu… Movin… No Se…       0    50 W     M      CHEV         SILV         
##  6 Royalton  Movin… No Se…       0    19 W     M      VOLK         JETTA        
##  7 Westmins… Vehic… No Se…       0    61 W     M      MITS         MIRAGE       
##  8 Royalton  Movin… No Se…       0    22 W     M      TOYT         COROLLA      
##  9 Westmins… Movin… No Se…       0    30 W     F      SUBA         LEGACY       
## 10 Shaftsbu… Movin… No Se…       0    16 W     F      SUBA         LEG          
## # ℹ 9,054 more rows
## # ℹ 1 more variable: Vehicle_Year <int>

Classification Tree

We began our analysis by creating a classification tree to determine the factors with the most significant influence over whether the stop led to an arrest.

##               CP nsplit  rel error   xerror       xstd
## 1   0.0450450450      0 1.00000000 1.000000 0.06628860
## 2   0.0210210210      3 0.86486486 1.067568 0.06843335
## 3   0.0180180180      6 0.80180180 1.112613 0.06982259
## 4   0.0135135135      9 0.74774775 1.121622 0.07009675
## 5   0.0105105105     11 0.72072072 1.139640 0.07064150
## 6   0.0090090090     17 0.65765766 1.166667 0.07144990
## 7   0.0078828829     20 0.63063063 1.166667 0.07144990
## 8   0.0067567568     26 0.58108108 1.184685 0.07198317
## 9   0.0060060060     28 0.56756757 1.193694 0.07224814
## 10  0.0045045045     31 0.54954955 1.193694 0.07224814
## 11  0.0030030030     38 0.51801802 1.234234 0.07342717
## 12  0.0022522523     44 0.50000000 1.261261 0.07420143
## 13  0.0020020020     95 0.36936937 1.292793 0.07509328
## 14  0.0018018018    115 0.31981982 1.346847 0.07659468
## 15  0.0015015015    135 0.27027027 1.522523 0.08125555
## 16  0.0012870013    182 0.18468468 1.567568 0.08240154
## 17  0.0011261261    217 0.12612613 1.720721 0.08616455
## 18  0.0010010010    258 0.06756757 1.738739 0.08659455
## 19  0.0009009009    267 0.05855856 1.761261 0.08712848
## 20  0.0007507508    279 0.04504505 1.774775 0.08744696
## 21  0.0000000000    285 0.04054054 1.774775 0.08744696
## 22 -1.0000000000    301 0.04054054 1.774775 0.08744696
## xerror cutoff      CP prune 
##    1.06628860    0.04504505

After running the classification tree using all reasons, we only get one node. The reason for this is the Arrest outcome is rare so it is not worth splitting the node. In an attempt to get a better tree, we will only use the two Reasons listed above. To do this we will clean the Reason data using filter to get a new data set where Reason only has Externally Generated Stop and Suspicion of DWI.

## # A tibble: 174 × 10
##    Agency    Reason Action Outcome   Age Race  Gender Vehicle_Make Vehicle_Model
##    <chr>     <chr>  <chr>    <dbl> <int> <chr> <chr>  <chr>        <chr>        
##  1 Westmins… Exter… No Se…       0    68 B     M      VOLV         TT           
##  2 Saint Jo… Exter… No Se…       0    41 B     M      HYUN         SANTAFE      
##  3 Saint Jo… Exter… No Se…       0    33 W     F      HYUN         ACCENT       
##  4 New Haven Exter… No Se…       0    30 W     M      VOLV         XC9          
##  5 Middlesex Suspi… No Se…       0    51 W     F      TOYT         PICK UP      
##  6 Westmins… Exter… No Se…       0    51 H     M      MACK         999          
##  7 Saint Jo… Exter… No Se…       0    39 W     F      FORD         F-150        
##  8 New Haven Exter… No Se…       0    68 W     M      CHEV         COLORADO     
##  9 Shaftsbu… Exter… No Se…       0    41 A     M      <NA>         CASCADIA     
## 10 Rutland   Exter… No Se…       0    25 W     M      TOYT         CAM          
## # ℹ 164 more rows
## # ℹ 1 more variable: Vehicle_Year <int>
##            CP nsplit  rel error   xerror      xstd
## 1  0.69444444      0 1.00000000 1.000000 0.1484273
## 2  0.11111111      1 0.30555556 1.444444 0.1677276
## 3  0.08333333      2 0.19444444 1.444444 0.1677276
## 4  0.01388889      4 0.02777778 1.277778 0.1615871
## 5 -1.00000000      6 0.00000000 1.277778 0.1615871
## xerror cutoff      CP prune 
##    1.14842726    0.04504505

Based on the results of both classification trees, it seems like only including Externally Generated Stops and Suspicion of DWI for the Reasons is most effective at creating a classification tree instead of a single node. We noticed that the classification tree begins with vehicle_model. The list of models is long but it suggests that the vehicle_model, the agency involved, and the operator’s age are the most significant predictors for an arrest. To further explore this, we will create some more graphs comparing vehicle model to arrests and agency to arrests but first we have to clean the data a bit more to make an acceptable graph.

Cleaning the Vehicle Model Data

## # A tibble: 1,246 × 2
##    Vehicle_Model Count
##    <chr>         <int>
##  1 CRV             197
##  2 CIVIC           176
##  3 OUTBACK         171
##  4 RAV4            151
##  5 RAM             131
##  6 JETTA           125
##  7 COROLLA         120
##  8 ACCORD          116
##  9 FORESTER        116
## 10 SILVERAD        116
## # ℹ 1,236 more rows
## # A tibble: 1,456 × 3
##    Vehicle_Model Outcome Number_of_Arrests
##    <chr>           <dbl>             <dbl>
##  1 ACCORD              1                 7
##  2 COROLLA             1                 6
##  3 MALIBU              1                 5
##  4 RAM                 1                 5
##  5 CIVIC               1                 4
##  6 RAV                 1                 4
##  7 SIERRA              1                 4
##  8 SILVERAD            1                 4
##  9 ALTIMA              1                 3
## 10 CIV                 1                 3
## # ℹ 1,446 more rows
## # A tibble: 10 × 3
##    Vehicle_Model Count Number_of_Arrests
##    <chr>         <int>             <dbl>
##  1 ACCORD          116                 7
##  2 COROLLA         120                 6
##  3 RAM             131                 5
##  4 MALIBU           44                 5
##  5 CIVIC           176                 4
##  6 SILVERAD        116                 4
##  7 SIERRA           97                 4
##  8 RAV              62                 4
##  9 CRV             197                 3
## 10 OUTBACK         171                 3

Now that we have cleaned the data further, we can make a graph comparing vehicle models with arrests. Since there are 145 models, we will only be using the top ten in arrest which we took care of above. Now we can use this new data set to make some graphs.

Creating the Vehicle Model Graphs

This graph clearly illustrates that the operators of Accords were arrested the most, with 1 more arrest than operators of Corollas who were the second most likely to be arrested. This could be expected because Accords and Corollas are common vehicle models. We don’t think there is a cause and effect relationship with the type of car given that the change in number of arrests is no more than 1. Now we will make a graph for arrests per agency and then a graph for arrests per age since these were the other two variables represented in our classification tree.

Exploring the number of arrests made by different agencies

The following graph shows the number of arrests made in each agency, clearly showing that Middlesex had the most arrests by far followed by Rutland and Williston.

## # A tibble: 10 × 2
##    Agency          Number_of_Arrests
##    <chr>                       <dbl>
##  1 Middlesex                      53
##  2 Rutland                        31
##  3 Westminster                    31
##  4 Williston                      31
##  5 Shaftsbury                     22
##  6 Saint Johnsbury                15
##  7 Saint Albans                   12
##  8 New Haven                      11
##  9 Derby                           9
## 10 Royalton                        7

The scatterplot above shows the number of arrests per agency. We can see that Middlesex has the most arrests by far while Williston, Westminster, and Rutland appear to be equal. We expected most agencies to have different numbers for arrests but we did not expect Middlesex to be such an outlier. We looked closer at the relationship between Agency and Outcome in the graphs below.

The following bar chart shows the percentage of total traffic stops in 2021 made up by each agency, compared to the percentage of 2021 arrests made up by each agency. Middlesex, while only making up about 14% of the total traffic stops in 2021, made up 27% of the VSP’s total arrests. New Haven and Royalton showed the opposite trend, making up 8.1% and 8.2% of 2021 traffic stops respectively, but only 4.1% and 2.7% of arrests.

The scatterplot above shows the percentage of stops made on males in each agency compared to the percentage of stops in that agency that led to arrests. There appears to be a very weak positive correlation between the percent of men stopped and the percent of arrests made.To test the relationship, we ran linear regression and found that if the percent of people stopped that are male increases by 1%, we expect the percent of people arrested to increase by 0.152%. The R-squared value of 0.026 shows that this is a poor predictor in determining the percent of stops that lead to arrests.

## 
## Call:
## lm(formula = Pct_arrested ~ Pct_male, data = agency_gender)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.06170 -0.16129  0.05817  0.15032  1.30792 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.64722    2.54708  -0.254    0.800
## Pct_male     0.05462    0.03992   1.368    0.173
## 
## Residual standard error: 0.9222 on 159 degrees of freedom
## Multiple R-squared:  0.01164,    Adjusted R-squared:  0.005423 
## F-statistic: 1.872 on 1 and 159 DF,  p-value: 0.1731
## # A tibble: 2 × 5
##   term        estimate std.error statistic p.value
##   <chr>          <dbl>     <dbl>     <dbl>   <dbl>
## 1 (Intercept)   -0.647      2.55    -0.254   0.8  
## 2 Pct_male       0.055      0.04     1.37    0.173

Analyzing arrests by age

The next variable we looked at was age.

## # A tibble: 50 × 2
##      Age Number_of_Arrests
##    <int>             <dbl>
##  1    17                 2
##  2    18                 5
##  3    19                 5
##  4    20                 9
##  5    21                 6
##  6    22                 6
##  7    23                11
##  8    24                 6
##  9    25                 5
## 10    26                11
## # ℹ 40 more rows

Now that we have a data set with the age and number of arrests per age, sorted by age from youngest to oldest, we can make a graph.

Creating the Age Graph

This graph tells us that the most common age to be arrested is between 23 and 33, with some outliers older than 66. This makes sense given younger drivers would be less experienced. These drivers would probably be the ones spending more time out at bars or parties and then driving.

Age vs Outcome, by Agency

This graph shows the age distributions within each VSP agency of people who were arrested in traffic stops vs those who were not. The data shows a lower and smaller interquartile age range for people who were arrested in every agency, although the means between the two groups are all very similar and hover around 35. In all agencies, the maximum age of people arrested is significantly lower than the maximum of those who were not.

Regression Tree

Next, we performed a regression tree analysis to compare the results with the classification tree.

##               CP nsplit  rel.error    xerror       xstd
## 1   0.0480529311      0 1.00000000 1.0002652 0.06464053
## 2   0.0301934508      1 0.95194707 0.9920021 0.06372319
## 3   0.0133443728      2 0.92175362 0.9379174 0.05967982
## 4   0.0104761825      3 0.90840925 0.9631053 0.06063252
## 5   0.0074060249      4 0.89793306 0.9761154 0.06113716
## 6   0.0063256502      7 0.87571499 0.9926181 0.06201817
## 7   0.0055411213      8 0.86938934 1.0082385 0.06258447
## 8   0.0051948012      9 0.86384822 1.0192475 0.06305697
## 9   0.0045549410     11 0.85345861 1.0194572 0.06342322
## 10  0.0044728856     18 0.82157403 1.0497753 0.06427976
## 11  0.0041216508     19 0.81710114 1.0746641 0.06501319
## 12  0.0038652996     30 0.76838702 1.1028974 0.06633445
## 13  0.0036888731     33 0.75679112 1.1173534 0.06698356
## 14  0.0035833236     35 0.74941338 1.1263000 0.06738566
## 15  0.0035816008     38 0.73866341 1.1215849 0.06731485
## 16  0.0035520008     39 0.73508181 1.1215849 0.06731485
## 17  0.0034904735     40 0.73152981 1.1215849 0.06731485
## 18  0.0033952098     43 0.72105839 1.1306440 0.06752501
## 19  0.0033371402     46 0.71041996 1.1568685 0.06892116
## 20  0.0032836274     49 0.70040854 1.1641599 0.06922405
## 21  0.0032708008     50 0.69712492 1.1707446 0.06951244
## 22  0.0031643871     52 0.69058332 1.1806952 0.06989048
## 23  0.0031166587     54 0.68425454 1.1911730 0.07035359
## 24  0.0031080007     58 0.67178791 1.1911525 0.07035363
## 25  0.0030784007     61 0.66246390 1.1882423 0.07028628
## 26  0.0030784007     63 0.65630710 1.1924905 0.07052234
## 27  0.0030784007     66 0.64707190 1.1924905 0.07052234
## 28  0.0030539134     68 0.64091510 1.1937834 0.07063183
## 29  0.0029684578     77 0.61210337 1.1941368 0.07066288
## 30  0.0025980294     78 0.60913491 1.2112429 0.07141027
## 31  0.0024627206     84 0.59354673 1.2312574 0.07218152
## 32  0.0024627206     85 0.59108401 1.2530169 0.07286178
## 33  0.0024552427     86 0.58862129 1.2530169 0.07286178
## 34  0.0022279925     91 0.57633306 1.2832434 0.07406738
## 35  0.0021438862     93 0.57187708 1.3036930 0.07494921
## 36  0.0020784268     97 0.56330153 1.3462112 0.07627850
## 37  0.0020683005    102 0.55190942 1.3476014 0.07629386
## 38  0.0020614291    106 0.54363622 1.3476014 0.07629386
## 39  0.0020522672    107 0.54157479 1.3476014 0.07629386
## 40  0.0020202005    111 0.53336572 1.3470968 0.07646787
## 41  0.0019789719    115 0.52528492 1.3643229 0.07703153
## 42  0.0019789719    117 0.52132698 1.3787770 0.07745870
## 43  0.0019789719    119 0.51736903 1.3787770 0.07745870
## 44  0.0019175940    120 0.51539006 1.3879616 0.07773376
## 45  0.0018861147    131 0.49306153 1.3967079 0.07807136
## 46  0.0018470404    137 0.48166907 1.4055161 0.07832597
## 47  0.0018470404    139 0.47797499 1.4353439 0.07918749
## 48  0.0017316004    141 0.47428091 1.4676604 0.08007952
## 49  0.0016379857    145 0.46735451 1.5641521 0.08282395
## 50  0.0016156147    189 0.38337811 1.6308369 0.08459901
## 51  0.0015788235    195 0.37368442 1.6677496 0.08556444
## 52  0.0015758480    202 0.35992264 1.6770150 0.08580922
## 53  0.0015751373    207 0.35134709 1.6907855 0.08615145
## 54  0.0015392004    221 0.32834091 1.7281527 0.08708561
## 55  0.0015392004    223 0.32526251 1.7327633 0.08720053
## 56  0.0015392004    226 0.32064491 1.7327633 0.08720053
## 57  0.0015229983    227 0.31910571 1.7326247 0.08720079
## 58  0.0015186777    230 0.31453671 1.7329667 0.08721258
## 59  0.0015106967    239 0.30086861 1.7327957 0.08721290
## 60  0.0015105756    242 0.29633652 1.7326721 0.08721315
## 61  0.0014976004    247 0.28749504 1.7328075 0.08722132
## 62  0.0014778428    250 0.28300224 1.7487153 0.08766058
## 63  0.0014722786    265 0.25961972 1.7532998 0.08777202
## 64  0.0013468003    268 0.25520288 1.8102150 0.08918446
## 65  0.0013355844    274 0.24712208 1.8330902 0.08978461
## 66  0.0013267296    278 0.24177974 1.8331050 0.08978458
## 67  0.0012929933    299 0.20686154 1.8521940 0.09025121
## 68  0.0012472753    309 0.19319299 1.8677316 0.09060612
## 69  0.0012270005    320 0.17947296 1.8952743 0.09125318
## 70  0.0012256478    326 0.17040912 1.8952607 0.09125322
## 71  0.0011796337    336 0.15675593 1.9323301 0.09204917
## 72  0.0011620257    346 0.14301697 1.9606856 0.09270501
## 73  0.0011544003    359 0.12522438 1.9606474 0.09270509
## 74  0.0011514677    360 0.12406998 1.9606474 0.09270509
## 75  0.0011376698    364 0.11946410 1.9618212 0.09271299
## 76  0.0011366403    368 0.11491343 1.9665847 0.09282391
## 77  0.0011194184    372 0.11036686 1.9897534 0.09334718
## 78  0.0010792754    376 0.10588919 1.9948326 0.09345286
## 79  0.0010216721    395 0.07893441 2.0219218 0.09407018
## 80  0.0009221273    413 0.06054432 2.0554310 0.09480916
## 81  0.0009216583    418 0.05593368 2.0630475 0.09493336
## 82  0.0009182126    423 0.05132539 2.0630475 0.09493336
## 83  0.0009160119    428 0.04673432 2.0630475 0.09493336
## 84  0.0008026375    433 0.04215426 2.0630590 0.09493430
## 85  0.0007982857    442 0.03493053 2.0632790 0.09492875
## 86  0.0007696002    455 0.02114864 2.0632630 0.09492879
## 87  0.0007562158    456 0.02037904 2.0632630 0.09492879
## 88  0.0005696550    459 0.01811040 2.0633981 0.09492949
## 89  0.0004397715    463 0.01583178 2.0645808 0.09493715
## 90  0.0003848001    464 0.01539200 2.0645808 0.09493715
## 91  0.0003848001    465 0.01500720 2.0645808 0.09493715
## 92 -1.0000000000    466 0.01462240 2.0645808 0.09493715
## x cutoff CP Prune 
##   0.9976   0.0302

##                  Overall
## Action       0.048052931
## Reason       0.033593889
## Vehicle_Year 0.005575210
## Vehicle_Make 0.004393561
## Agency       0.003754162
## Age          0.000000000
## Race         0.000000000
## Gender       0.000000000

This analysis affirms that Action Taken, followed by Reason for Stop are the most likely predictors of whether an arrest was made. The R^2 value is very low at 0.04489541, indicating that the model cannot make predictions with any strong degree of certainty. This is largely due to the fact that an arrest was a rare outcome and there was no set of uniform circumstances surrounding the majority of them.

## # A tibble: 2 × 7
##   Outcome   Min.        `1st Qu.`   Median      Mean        `3rd Qu.`   Max.    
##   <chr>     <table[1d]> <table[1d]> <table[1d]> <table[1d]> <table[1d]> <table[>
## 1 predicted 0.02247564  0.02247564  0.02247564  0.0244925   0.02247564  0.59375 
## 2 actual    0.00000000  0.00000000  0.00000000  0.0244925   0.00000000  1.00000
##           R2        MAE   MAE_mean mae_reduct
## 1 0.04805293 0.04548901 0.04778523 0.04805293
##   node    n
## 1    2 9032
## 2    3   32

Comparing stops that led to Arrests vs Non-Arrests for each Reason

In the following graph we analyzed how many arrests resulted from stops according to the reason for the stop.

This graph shows us the difference between Non-Arrest and Arrest Outcomes for each Reason. We can clearly see that Non-Arrest is a much more common Outcome than Arrest, which makes sense. We expected this because Non-Arrests is every other Outcome. We can also see from the graphs that there seems to be a cause and effect relationship between Moving Violations and being stopped. Vehicle Equipment is also a common Reason for being stopped.

Conclusions

Using the graphs and the classification tree, we can come to some conclusions about the data. First, Non-Arrest is a far more likely outcome than an Arrest. As for Reasons, Externally Generated Stops and Suspicion of DWI are the two Reasons with the highest percentage of arrests. Our classification tree told us that Vehicle_Model, the Agency Involved, and the Age of the operator were the most significant variables to decide if the Outcome was an Arrest or Non_Arrest. When exploring those three variables and creating graphs, we found the Accord was by far the most Arrested Vehicle Model, Middlesex was the Agency with the most Arrests, and operators age 23 to 33 were most likely to be arrested. After running a regression tree, we saw that Reason was the only variable in the tree. An arrest was likely if the Reason was Externally Generated Stop or Suspicion of DWI. Otherwise the Outcome was most likely to be Other. We also ran a variable importance test and found that the Reason and Agency were the two most likely predictors of whether the Outcome was Arrest. However, the R^2 value was very low at 0.045, meaning the Outcome cannot be reasonably predicted with any degree of certainty using the variables Age + Race + Gender + Vehicle_Year + Vehicle_Make + Agency + Reason + Action.

Limitations and Recommendations

As we discovered with the machine learning techniques, there does not seem to be a way to accurately predict whether a traffic stop will result in an arrest. We were limited by the type of data we had. Since our data was mostly categorical rather than numeric, we were unable to use all the machine learning techniques we were taught in class. Our recommendation for future work would be to include data from other states to have a larger data set. We would also recommend exploring models using an Outcome other than Arrest. Just because our models were not able to accurately predict whether the Outcome was Arrest or Non-Arrest does not mean other Outcomes, such as a warning, could not be predicted.