In: Statistics and Probability
Use RStudio. The carsafety data set in the UsingR package has records of the number of passenger deaths in the “Other.deaths” column and the type of vehicle in the type column. Determine which type of vehicle is the deadliest for passengers by looking at difference in variance between groups.
ANSWER::
install.packages("UsingR")
library(usingR)
data("carsafety")
newDF = aggregate(. ~ type, carsafety, sum)
newDF$Make.model<- NULL
newDF=transform(newDF,Deaths= Other.deaths+Driver.deaths)
newDF
newDF$Driver.deaths<- NULL
newDF$Other.deaths<- NULL
plot(Tota_Deaths ~ type, data = newDF)
plot(Other.deaths ~ type, data = newDF)
Table 1:
Fig 1:
From Table 1 and Fig 1, we can say that if we look at total deaths (both driver and passenger) then "Subcompact" type vehicles are the most dangerous as it is also clearly visible from the plot but if we look at only other deaths or (passenger deaths) then SUVs are the most dangerous vehicles (Fig 2 and Table 1).
I have given the code to generate the above table and figure.
Fig 2:
NOTE:: I HOPE YOUR HAPPY WITH MY ANSWER....***PLEASE SUPPORT ME WITH YOUR RATING...
***PLEASE GIVE ME "LIKE"...ITS VERY IMPORTANT FOR ME NOW....PLEASE SUPPORT ME ....THANK YOU