Abstract: The scatterplot and government sourced data dmeonstrated that displacement and highway milleage have a strong negative correlation. Furthermore, there are three outliers all from the same maker Voltswagon and manufactured in 1999. These cars share key characterstics such as running on diesel, two Voltswagon Jetta models having manual transimission, and compact or subcompact body.
Introduction: The data was gathered by the U.S. Department of Energy and the mpg reports are still accessible in datafile and pdf format. Due to parts of the data going back to 1999 there could be inconsistent data with today’s approach of calculating car fuel efficiency.
Data Description:
The scatterplot below is representing x as displ, defined as engine displacement and y as hwy defined as highway milleage. Engine displacement is the measure of cylinder volume swept by all of the pistons of a piston engine.
Data Analysis:
The scatterplot is demonstrating a strong negative correaltion between engine diplacement and highway mileage across the different car classes. A high engine displacement results in more engine power which leads to more fuel consumption and less highway milleage efficiency. This relationship is evident in the graph as cars with a displacement of 4 or higher tend to average around 16-20 mpg on the highway. In contrast, cars with a lower than 4 displacement average around 25-30 mpg on the highway. Another important observation is that bigger cars such as suvs and pickups have higher displacements and are less fuel efficient. As can be seen in the graph, there are three red dots (2 dots are overlapping) that reperesent outliers. These cars share key characterstics such as running on diesel, two Voltswagon models having manual transimission, and similar class either compact or semicompact. According to the U.S. department of energy, diesel cars can travel 20-35% farther on a galon of fuel compared to regular cars. In addition, a manual transimission improves gas mileage by 2-5 mpg compared to automatic transimission. These two sets of information are salient, when comparing a 1999 Voltswagon Jette 1.9L manual transimission diesel to it's counterpart with automatic transimission and regular fuel. Furthermore, the 1999 Voltswagon new bettle 1.9L automatic has 41 mpg hwy compared to the same model only that with a manual transmisison has 44mpg. This supports the statement above that manual transimission cars improve mileage by 2-5mpg.
Conclusion:
library(ggplot2)
ggplot(data=mpg)+
geom_point(mapping = aes(x = displ, y = hwy, color=class))
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
mpg=mutate(mpg,ptColor="black")
mpg[mpg$hwy>40,"ptColor"]="red"
g=ggplot(data=mpg)+geom_point(mapping=aes(x=displ,y=hwy,color=ptColor))
print(g)
g=ggplot(data=mpg)+geom_point(mapping=aes(x=displ,y=hwy,color=ptColor))+scale_color_manual(values=c("black","red"))
print(g)
ggplot(data=mpg) +
geom_bar(mapping=aes(x=manufacturer,fill=class))