Fuel Economy Estimator (MPG)
Janpu Hou, Cyber Student of Coursera by Brian Caffo, Jeff Leek, and Roger Peng
December 22, 2015
This estimator is based on the following “multiple regression” mean function:
\[ E(Y |X) = \beta_0 + \beta_1\cdot X_1 + \beta_2\cdot X_2 + \beta_3\cdot X_3 + \beta_4\cdot X_4 \]
Where \[ X_j \] are predictor variables in the model
j = 1, is weight of the car in lbs
j = 2, is number of cylinders of the car
j = 3, is type of transmission of the car (1 = manual, 0 = automatic)
j = 4, is time required to reach quarter miles in seconds
while \[ \beta_0, \beta_1, \beta_2, \beta_3, \beta_4 \] can be obtained by fitting linear model in R:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 14.9288749 12.9058943 1.1567486 0.2575073944
wt -3.6438922 0.9097014 -4.0055913 0.0004360708
cyl -0.3542112 0.7207060 -0.4914781 0.6270600798
am 2.4679373 1.7182631 1.4362977 0.1624040912
qsec 1.0126280 0.5233825 1.9347763 0.0635587791
This Shiny App can be view from this shinyapps.io link
The input side panel will require you to select cylinders number, transmission type, weight of the car and time required to reach quater miles.
R code for this Shiny App can be view from this github.com link
The output panel will show the number of your estimated mpg and compared with others from “mtcars”