Giter Club home page Giter Club logo

slidifyproject's Introduction

title subtitle author job framework highlighter hitheme widgets mode knit
Vehicle Mileage prediction.
Predicts mpg from horse power, num. of cylinders, and weight.
Damodar Panigrahi
Software/Data architect/developer
io2012
highlight.js
tomorrow
mathjax
quiz
bootstrap
selfcontained
slidify::knit2slides

Executive Summary

mtcars dataset is used. A bestfit model is discovered using regression analysis. Then, mpg (miles per gallon) is predicted for a set consisting of horse power, number of cylindres, and weight of the vehicle. The data is analyzed to find out interesting patterns. Number of cylinders, for example, has only 4, 6, or 8 cylinders.

Analysis - Exploratory

Load data set 'mtcars', and peak at it.

set.seed(12345)      #A random number, used as a good practice, 
data(mtcars)
names(mtcars)
##  [1] "mpg"  "cyl"  "disp" "hp"   "drat" "wt"   "qsec" "vs"   "am"   "gear"
## [11] "carb"

Analysis - Exploratory - continuing

summary(mtcars) #the output is suppressed, to comply with page limitations
head(mtcars,n=3)
##                mpg cyl disp  hp drat    wt  qsec vs am gear carb
## Mazda RX4     21.0   6  160 110 3.90 2.620 16.46  0  1    4    4
## Mazda RX4 Wag 21.0   6  160 110 3.90 2.875 17.02  0  1    4    4
## Datsun 710    22.8   4  108  93 3.85 2.320 18.61  1  1    4    1

Different Number of Cylinders:

unique(mtcars$cyl)
## [1] 6 4 8

The above information was used to restrict the input for number of cylinders in the Shiny UI.


Best Fit Model and Predict Function

#find the best regression model of MPG based on horsepower, number of cylinders, and weight
modelFit <- lm(mpg ~ hp + cyl + wt, data=mtcars)
print(modelFit)
## 
## Call:
## lm(formula = mpg ~ hp + cyl + wt, data = mtcars)
## 
## Coefficients:
## (Intercept)           hp          cyl           wt  
##    38.75179     -0.01804     -0.94162     -3.16697
#predicts MPG based on horsepower, number of cylinders, and weight
predictedMPG <- function(horsepower, numcylinders, weigth) {
  modelFit$coefficients[1] + modelFit$coefficients[2] * horsepower + 
    modelFit$coefficients[3] * numcylinders + modelFit$coefficients[4] * weigth
}

Test for hp=200, num cyl=6, and weight=5000

plot of chunk unnamed-chunk-6

slidifyproject's People

Contributors

dpanigra avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.