Performace Analysis of Cars

We have used the ‘Auto-MPG Data’ datasetto understand how weight (wt), horsepower (hp), and number of cylinders (cyl) affects the acceleration of a car. And also to visualise the horspower and displacement variations in the dataset. The dataset contains the technical specifications of the various vehicles. The dataset is downloaded from the UCI Machine Learning Repository.

Attribute Information:

  1. mpg : continuous
  2. cylinders : multi-valued discrete
  3. displacement : continuous
  4. horsepower: continuous
  5. weight : continuous
  6. acceleration : continuous
  7. model year : multi-valued discrete
  8. origin : multi-valued discrete
  9. car name : string (unique for each instance)

Visualization of Data

Acceleration vs Horsepower

Plotting the acceleration along the x axis and the horsepower along the y axis we obtain the plot shown below. Number of cylinders in the engine is visualized by the use of different colors and the weight of the cars are visualized by the size of an individuals point of the plot.

suppressPackageStartupMessages(library(plotly))


plot_ly(data = cars, x = ~acceleration, y = ~horsepower, 
        color = ~as.factor(cylinders), size = ~weight,
        text = ~paste("0 - 60mph : ", acceleration, 'sec <br>Horsepower: ', horsepower,'<br>Displacement : ', displacement ,'ci <br>Weight : ',weight,'lbs <br>Model:',car.name, '<br> Year : 19',model.year),
        type = "scatter", mode = 'markers') %>%
  layout(title = "Acceleration vs Horsepower")

Horsepower vs Displacement

Plotting the horsepower along the x axis and the displacement along the y axis we obtain the plot shown below. Number of cylinders in the engine is visualized by the use of different colors.

plot_ly(data = cars, x = ~horsepower, y = ~displacement, 
        color = ~as.factor(cylinders),
        text = ~paste("Horsepower : ", horsepower, 'hp <br>Displacement : ', displacement ,'ci <br>Model : ',car.name, '<br>Year : 19', model.year),
        type = "scatter", mode = 'markers') %>%
  layout(title = "Horsepower vs Displacement")

Acknowledgements

Dataset: UCI Machine Learning Repository

Data link : https://archive.ics.uci.edu/ml/datasets/auto+mpg