Socrates Krishnamurthy
Calculation of 'Mileage' of various cars across the Globe is challenging and time consuming. This interactive application helps predict the mileage of a car when a set of parameters are provided.
What this application do -
mtcars dataset provided by 'Motor Trends Magazine' as referencelibrary(datasets); data(mtcars)
linearModel <- lm(mpg ~ wt + cyl + disp + hp + am, data = mtcars)
Linear Model - Intercepts and Slope
linearModel[1]
$coefficients
(Intercept) wt cyl disp hp am
38.20279869 -3.30262301 -1.10637984 0.01225708 -0.02796002 1.55649163
Get the following input for a car:
Create Dataframe with Input
df <- data.frame(wt=wtIn, cyl=cylIn, disp=dispIn, hp=hpIn, am=as.numeric(amIn))
Predicted Mielage
#Considering Default values..
df <- data.frame(wt=3.325, cyl=6, disp=196.3, hp=123, am=as.numeric(0))
predict(linearModel, newdata=df)
1
19.55028