MPGView: Find the Vehicle Best for Fuel Economy

Posted on Nov 7, 2016

America is a nation on wheels. According to 2014 stats, there are 797 cars owned per 1000 people in America.ref Besides paying the price for the vehicle, people spend thousands of dollars on gas every year. In fact, the annual fuel cost varies dramatically between cars and a small change in a vehicle's parameters can add 1000 dollars to a gas bill every year. Therefore, understanding fuel consumption is important, especially for those who want a fuel efficient car in the near future. For me, a training data scientist and car enthusiast, I targeted my project towards MPG and created this shiny app---MPGView What is described here is a Shiny app built in R that provides multiple perspectives on gas usage in cars.

About the Data

2012 to 2017 vehicle data was downloaded from the U.S. Department of Energy. Fuel economy data comes from vehicle testing done at the Environmental Protection Agency's National Vehicle and Fuel Emissions Laboratory in Ann Arbor, Michigan, and by vehicle manufacturers with oversight by EPA.

Data merging, cleaning and feature creation were performed in R, and the app is powered by the Shiny package. All code can be found here.

Using the App

Figure 1.

Figure 1. Welcome page panel.

When entering the app, you will see a welcome page. This page gives a brief introduction to this app. On the top of the screen you will see three additional tabs. "Understand MPG" tab will help users visualize how mpg changes between different types of cars. The "Explore by Manufacturer" tab is a place for users to see the progress of increasing fuel economy by each manufacturer. Finally, "Select Your Next Vehicle" tab is a place to get a recommendations on your next car based on the parameters selected. Now let's dive into the app and examine the functions one by one.


Figure 2. Understand the MPG panel.

As shown above, users can select the type of vehicle and an MPG measurement on the left. After clicking "submit", four plots will be generated to demonstrate the behavior of mpg with respect to other parameters. On the top left is a box-plot showing the distribution of MPG values versus transmission type. Below is a scatter plot and curve fit of MPG versus engine displacement. The two graphs on the right are vehicle distribution among fuel requirements and drive types, respectively.


Figure 3. Explore by Manufacturer panel.

Above shows the interface of the second panel. Users can explore the development of fuel efficiency across six years (2012 - 2017). By selecting a vehicle manufacturer of interest, an interactive google motion chart will be generated to facilitate the visualization.


Figure 4. Select Your Next Car panel.

In the final panel, users can filter the entire data set based on the information set on the left. Selections include:

  • Vehicle Condition: New, Like New, Used
  • Vehicle Type: Car, SUV, Truck, Van
  • Vehicle Class: Family, Luxury, Super
  • Transmission Type: Automatic, Manual

After clicking "Get range" button, a slider input will be generated based on the information selected. Users can then determine how much he/she wants to pay for fuel each year. After all selections are made, click "Get result" button and this will generate an interactive table containing all vehicles that fit the requirements along with a variety of key parameters of these vehicles.

Takeaways and Future Direction

By exploring this app, we can see that fuel economy is highly related to both vehicle type and their parameters. For example, most of the SUVs require regular gasoline while most cars require premium gasoline, and cars with continuous variable transmission are relatively more fuel efficient.

This app can be useful when looking for a car.  For example, while everyone know that SUV’s use more gas than a Tesla, let’s say, there are still choices to be made among SUV’s.  A Lexus RX Hybrid is a better choice than a Range Rover in terms of expected expenditure on gas.

To expand the function of this app, more features can be added to the data. In exploring the MPG tab, adding features like vehicle weight will result in a more complete exploration. In the recommendation tab, including vehicle price in selection bar can help users locate their desired car more effectively. Last but not least, besides mechanistic parameters, we can further expand our recommendation system by inclusion of vehicle style features.

About Author

Xinyuan Wu

Xinyuan recently obtained his Ph.D. from North Carolina State University. He gained quantitative analysis, statistical knowledge and critical thinking from years of research on magnetic and photophysical chemistry. His belief in the trend of predictive analysis, along with...
View all posts by Xinyuan Wu >

Related Articles

Leave a Comment

Car Fuel Consumption Tables ⋆ July 8, 2017
[…] The original CAFE standards set minimum average fuel consumption performance (average miles travelled per gallon of fuel used) for the fleets of new “passenger automobiles” (passenger cars) and “non-passenger automobiles” (light trucks, which includes many SUVs) produced by each manufacturer. [7] Therefore, understanding fuel consumption is important, especially for those who want a fuel efficient car in the near future. [8] […]

View Posts by Categories

Our Recent Popular Posts

View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI