Dataset Information

Data Description: This dataset is from Kaggle and contains 8,652 car crashes.

Key Variables:

Weight - weight of car

Dead - if the driver is alive or dead

Airbag - if the vehicle had an airbag or none

Seatbelt - if the driver had their sealtbelt on or not

Dataset Information Continued

Key Variables Continued:

Sex - gender of the driver

AgeOfocc - the age of the driver

Yearacc - the year the accident occurred

YearVeh - the year of the vehicle

Frontal - if it was a front collision or not

Loading dataset

Here is how I loaded the data:

#libraries
library(ggplot2)
library(plotly)
library(dplyr)

#load data
car_crashes = read.csv("cars.csv")

#clean some of the data
#(taking out outliers from the weight column)
car_crashes = car_crashes %>% filter(weight <= 5000)

Plotly 3-D Plot Exaplanation

This next plot here is called the weight of death.

I only called it that because it has weight as an axis.

It shows the year of the vehicle, weight of the car, and age of the driver as well as if they died or survived.

So it sums up information about the vehicle and driver and shows how that influences the mortality rate.

Plotly 3-D Plot

plotly scatterplot:

GGplot Bar Chart: Airbag VS Death

These next to bar charts show simply show the survival rate of drivers with and without safety features.

GGplot Bar Chart: Seatbelt VS Death

GGplot Box Plot: Driver Age VS Year Of Accident

Descriptive Statistical Analysis

#make new columns that turn discrete vals into continuous vals
car_crashes = car_crashes %>% mutate(a2 = ifelse(airbag == "airbag", 1, 0),
seatbelt2 = ifelse(seatbelt == "belted", 1, 0),
sex2 = ifelse(sex == "m", 1, 0))

#five-number summary 
car_crashes %>% group_by(dead) %>% summarise(mean_age = round(mean(ageOFocc), 1),
  mean_sex = round(mean(sex2), 3),
  mean_airbag = round(mean(a2), 3),
  mean_seatbelt = round(mean(seatbelt2), 3),
  mean_frontal = round(mean(frontal), 3)
)
## # A tibble: 2 × 6
##   dead  mean_age mean_sex mean_airbag mean_seatbelt mean_frontal
##   <chr>    <dbl>    <dbl>       <dbl>         <dbl>        <dbl>
## 1 alive     36.8    0.532       0.55          0.719        0.652
## 2 dead      45.8    0.581       0.407         0.424        0.467

Analysis and Commentary

Description: My data is grouped by death. I wanted to see what safety factors affected survivability including airbags and seatbelts. I also wanted to see what other factors could be involved such as age, sex, and if the collision was from the front.

Data Clarification: when reformatting data, males were set to 1, females were set to 0. A vehicle equipped with airbags were set to 1, no airbags were set to 0. A seatbelt being used was set to 1, no seatbelt was set to 0. frontal collision was set to 1, A non-frontal collision was set to 0.

Age: The average of people who survived is 37 years old, weheras the average of those who perished was 46 years old. This shows that older individuals who were in car crashes were more likely to pass away.

Analysis and Commentary Continued

Sex: Since males were set to 1 in the data, we can see that 53.2% of the drivers who survived were male and 58.1% of drivers who didnt survive were male.

Airbag: Of the drivers who survived, 55% had airbags equipped. On the contrary, 40.7% of the drivers who didnt survive, had airbags. Based on this, drivers who didnt have airbags died more frequently than drivers who did have airbags.

Seatbelt: Of the drivers who survived, 71.9% had their seatbelts on. However, 42.4 of the drivers who didnt survive, had their seatbelts on. Based on this, drivers who didnt have their seatbelts on died more frequently than drivers who did.

Frontal collision: 65.2% of the drivers who survived were frontal collisions. 46.7% of the drivers who didnt survive were frontal collisions.

Conclusion

Conclusion: Based on the analysis, it seems safety features are a very important factor when it comes to the survivability of the driver in a car accident. You are more likely to survive if you have your seatbelt on and airbags in your car. I also conclude that age may play a big factor in fatal car crashes. It was surprising to see that of the drivers who passed away, only 46.7% were frontal collisions. I would have expected 80% of them were from the front. Finally, I believe sex could be misleading because most drivers on the road might be male.