Skip to content

Repository files navigation

EPA Fuel Cost Prediction

Predicting annual fuel cost and analyzing the impact of vehicle characteristics on fuel efficiency using the 2025 EPA Fuel Economy dataset.

Author: Samay Suratwala

Project Overview

This project analyzes the 2025 EPA Fuel Economy Guide dataset to understand what vehicle characteristics are associated with annual fuel cost and whether transmission type is associated with combined fuel efficiency.

The dataset contains 868 vehicle configurations across 23 manufacturers and 20 vehicle classes. Each observation represents a specific vehicle configuration, including engine displacement, cylinder count, transmission type, drivetrain, vehicle class, fuel efficiency ratings, and EPA-estimated annual fuel cost.

The project includes exploratory data analysis, statistical testing, multiple linear regression, and a multi-model predictive benchmark comparing linear and tree-based machine learning models.

Research Questions

  1. Can a parsimonious set of measurable vehicle characteristics reliably predict a vehicle's annual fuel cost?

  2. Is there a statistically significant association between transmission type and combined fuel efficiency?

Dataset

The dataset used in this project is:

2025 Fuel Economy Dataset(FEguide).csv

Source: 2025 EPA Fuel Economy Guide.

Key variables include:

  • annual_fuel_cost: EPA-estimated annual fuel cost, used as the target variable.
  • comb_fe: combined fuel efficiency in miles per gallon.
  • city_fe: city fuel efficiency.
  • hwy_fe: highway fuel efficiency.
  • engine_displacement: engine size in liters.
  • num_of_cylinders: number of cylinders.
  • trans_description: transmission type.
  • drive_desc: drivetrain type.
  • carline_class_desc: EPA vehicle class.
  • air_aspiration: engine aspiration type, such as naturally aspirated, turbocharged, or supercharged.
  • stop_start_system_status: whether the vehicle has a stop/start system.

The EPA annual fuel cost estimates are based on the assumption that the vehicle is driven 15,000 miles per year, with 55% city driving and 45% highway driving. Fuel price assumptions used by the EPA include approximately $3.99 per gallon for regular unleaded gasoline, $4.98 per gallon for mid-grade unleaded gasoline, and $5.61 per gallon for premium unleaded gasoline.

File-by-File Description

2025 Fuel Economy Dataset(FEguide).csv

Raw 2025 EPA Fuel Economy Guide dataset used for the entire project.

Contains 868 vehicle configurations and 27 columns, including:

  • Model Year
  • Mfr Name
  • Division
  • Carline
  • Engine Displacement
  • Num of Cylinders
  • City FE
  • Hwy FE
  • Comb FE
  • City Unadj FE
  • Hwy Unadj FE
  • Comb Unadj FE
  • Trans Description
  • Num Gears
  • Lockup Torque Converter
  • Trans Creeper Gear
  • Drive Desc
  • Max Ethanol Percent
  • Max Biodiesel Percent
  • Fuel Usage Desc
  • Release Date
  • Descriptor Model Type
  • Carline Class Desc
  • Annual Fuel Cost
  • GHG Rating
  • Stop/Start System Status
  • 4Dr Pass Vol
  • Air Aspiration

This file is the source data for both the exploratory data analysis and the final predictive modeling paper.


EPA Fuel Economy EDA - Samay Suratwala.Rmd

R Markdown source file for the exploratory data analysis.

This file contains the reproducible R code and written analysis for:

  • Loading and cleaning the dataset.
  • Converting character variables to factors.
  • Creating numeric and categorical data quality reports.
  • Identifying missing data issues.
  • Exploring fuel efficiency, engine displacement, cylinders, drivetrain, transmission type, stop/start systems, and air aspiration.
  • Producing correlation analysis and visualizations.
  • Investigating follow-up questions about stop/start systems and turbocharging.

This file is intended to be opened and run in RStudio.


EPA-Fuel-Economy-EDA---Samay-Suratwala.html

Rendered HTML output of the exploratory data analysis R Markdown file.

This file allows the exploratory analysis to be viewed directly in a web browser without opening RStudio. It contains:

  • Data cleaning code.
  • Data quality tables.
  • Visualizations.
  • Written observations.
  • Follow-up EDA questions and summaries.

Annual_Fuel_Cost_Prediction_Final_Paper_SamaySuratwala.Rmd

R Markdown source file for the final analysis and modeling paper.

This file contains the reproducible R code and written analysis for:

  • Data cleaning and preparation.
  • Correlation analysis.
  • One-way ANOVA testing transmission type against combined fuel efficiency.
  • Multiple linear regression predicting annual fuel cost.
  • Simplification of vehicle class into interpretable groups.
  • Random Forest variable importance.
  • Multi-model benchmarking using OLS, Elastic Net, Quantile Regression, Bayesian Regression, Decision Tree, Random Forest, and XGBoost.
  • Final conclusions, limitations, and practical implications.

This file is intended to be opened and run in RStudio.


Annual_Fuel_Cost_Prediction_Final_Paper_SamaySuratwala.html

Rendered HTML output of the final paper R Markdown file.

This file allows the final analysis to be viewed directly in a web browser without opening RStudio. It contains:

  • Introduction and research questions.
  • Dataset description.
  • Cleaning summary.
  • Statistical results.
  • Regression tables.
  • ANOVA results.
  • Random Forest variable importance.
  • Final model comparison scorecard.
  • Conclusions and limitations.

Fuel_Cost_Prediction_Presentation - Samay Suratwala.pdf

Presentation slide deck summarizing the project.

This PDF contains:

  • Project motivation.
  • Research questions.
  • Dataset overview.
  • Key summary statistics.
  • Exploratory data analysis highlights.
  • Multiple linear regression results.
  • Important predictors of annual fuel cost.
  • Model performance comparison.
  • Key takeaways, implications, limitations, and future work.

README.md

This documentation file.

It explains the purpose of the repository, the dataset, the analysis, the file contents, and how to reproduce the work.


LICENSE

MIT License for this project.

This file defines the permissions, conditions, and limitations for using, modifying, and distributing the project code and analysis materials.

How the Files Connect

The workflow of the project is:

  1. 2025 Fuel Economy Dataset(FEguide).csv provides the raw data.
  2. EPA Fuel Economy EDA - Samay Suratwala.Rmd performs the initial exploratory analysis.
  3. EPA-Fuel-Economy-EDA---Samay-Suratwala.html displays the rendered exploratory analysis.
  4. Annual_Fuel_Cost_Prediction_Final_Paper_SamaySuratwala.Rmd performs the final statistical and predictive modeling analysis.
  5. Annual_Fuel_Cost_Prediction_Final_Paper_SamaySuratwala.html displays the rendered final paper.
  6. Fuel_Cost_Prediction_Presentation - Samay Suratwala.pdf presents the project in slide format.

Key Results

Combined fuel efficiency is the strongest predictor of annual fuel cost. Each additional MPG of combined fuel efficiency is associated with about $73 lower annual fuel cost, holding other variables constant.

Number of cylinders, drivetrain type, and vehicle class also provide meaningful explanatory power.

The ANOVA results show that transmission type is significantly associated with combined fuel efficiency, with an F-statistic of about 111.48 and a p-value less than 0.0001.

Tree-based models outperformed linear models. XGBoost produced the best overall predictive performance, followed closely by Random Forest.

Approximate test-set results:

Model RMSE R-squared MAPE
XGBoost 183.48 0.9425 5.16%
Random Forest 184.86 0.9417 4.76%
Decision Tree 193.07 0.9366 5.59%
Elastic Net 266.42 0.8794 8.75%
OLS 266.59 0.8797 8.81%
Quantile Regression 278.91 0.8732 9.10%
Bayesian Regression 1964.71 0.7866 74.09%

How to Reproduce the Analysis

To reproduce the analysis:

  1. Install R and RStudio.
  2. Clone or download this repository.
  3. Make sure the dataset file 2025 Fuel Economy Dataset(FEguide).csv is in the same folder as the R Markdown files.
  4. Open EPA Fuel Economy EDA - Samay Suratwala.Rmd or Annual_Fuel_Cost_Prediction_Final_Paper_SamaySuratwala.Rmd in RStudio.
  5. Knit the document to reproduce the HTML output.

Required R packages include:

tidyverse, janitor, funModeling, skimr, readxl, readr, lubridate, DataExplorer, dlookr, knitr, gt, ggridges, PerformanceAnalytics, tidymodels, vip, rpart.plot, ranger, xgboost, rstanarm, quantreg, kableExtra, randomForest, broom, and cowplot.

Limitations

This analysis has several limitations.

  • The dataset does not include vehicle weight, which is an important determinant of fuel consumption.
  • Aerodynamic drag, tire rolling resistance, and detailed transmission gear ratios are not available.
  • The analysis is limited to the 2025 model year.
  • EPA laboratory test values may not perfectly reflect real-world driving behavior.
  • Engine displacement and cylinder count are highly correlated, so careful feature selection was needed.
  • The Bayesian regression model used relatively tight priors for this data scale, which affected its performance.

Future Work

Possible extensions include:

  • Adding interaction terms such as combined fuel efficiency by cylinder count or combined fuel efficiency by drivetrain.
  • Testing stacking or blending methods that combine linear model interpretability with tree-based predictive strength.
  • Incorporating multiple years of EPA fuel economy data to study trends over time.
  • Expanding the analysis to include electrified vehicles.
  • Incorporating real-world fuel prices, driving patterns, and regional cost differences.

Conclusion

Combined fuel efficiency is the single most useful specification for estimating annual fuel cost. Cylinder count, drivetrain type, and vehicle class add meaningful explanatory power even after controlling for fuel efficiency.

Transmission type is significantly associated with combined fuel efficiency, with CVTs and automated manual transmissions generally showing stronger efficiency performance.

Tree-based models, especially XGBoost and Random Forest, outperform linear models, indicating that nonlinear relationships and interactions improve prediction of annual fuel cost.

License

This project is licensed under the MIT License. See LICENSE for details.

The EPA Fuel Economy dataset is included for analysis and reproducibility and may be subject to its own data terms.

About

Predicting annual fuel costs and analyzing vehicle efficiency using the 2025 EPA Fuel Economy dataset. Features EDA, inferential statistics, and a 7-model ML benchmark (XGBoost, Random Forest, Decision Tree, Elastic Net, OLS, Quantile Regression, Bayesian Regression) in R to identify key cost drivers like MPG, cylinders, and drivetrain.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages