Prediction for Car Mileage using Simple linear model

Jawad Rashid
July 24 2014

Introduction

  • Motivation for this product is so that we can use past data collected to estimate mileage(Miles/Gallon) based on other measured attributes of number of cylinders, number of gears, engine type, transmission and number of carburetors.
  • This product can help users input their car detail and calculate estimated mileage for their car.
  • Also, user can also see the effect of using all the measured readings for the car on the mileage versus using only few attributes or single attributes on the mileage by using complex or simple predicton model.
  • Project link.

Model Detail

This section gives some intitution about the different type of models used to predict Miles/gallon.

  • The complex model given below outputs mpg(miles/gallon) taking in account values of the all available attributes using linear model.
allModel <- lm(mpg ~ cyl + vs + am + gear + carb, mtcars)
  • A simpler model is given below which uses only one variable.
cylModel <- lm(mpg ~ cyl, mtcars)

Model Summary

Here below is the table generated by prediction on different type of model for the input value of 4 cylinder, V Engine, Automatic, 3 Forward Gears, 1 carburetor car:

modelsSummary
                  Model Miles.Gallon
1                   All        22.61
2    Cyl, Trans, Engine        22.97
3    Number of Cylinder        26.38
4     Transmission Type        17.15
5           Engine Type        16.62
6 Number of carburetors        23.82
7       Number of Gears        17.39

Extensions

These are the future extensions to the project which can enhance the quality of the product.

  • Use better regression analysis by using multivariate regression to enhance the estimation.
  • Use statistics and standarized tests to evualuate the model and use the best model for prediction.
  • Include more interactive plots to explore the data and the results.
  • Include more variables and more data points to enhance the accuracy of the model.