Slidify Presentation: Motor Trend Car Road Tests

Uma Balakrishnan
January 15, 2016

This presentation is to explore the mtcars datasets in R package. The relationship between a set of variables and miles per gallon (MPG) (outcome) are presented. Particularly the presentation will answer

“Is an automatic or manual transmission better for MPG”“

** Data Processing: Load mtcars from R datasets **

library(datasets)
data(mtcars)
mtcars$am <- factor(mtcars$am, labels = c("Automatic", "Manual"))

Simple Regression Model

rm_simple <- lm(mpg ~ am, data = mtcars)
rm_simple

Call:
lm(formula = mpg ~ am, data = mtcars)

Coefficients:
(Intercept)     amManual  
     17.147        7.245  

Multivariate Regression Model

rm_multi <- lm(mpg ~ cyl + disp + hp + wt + am, data = mtcars)
rm_multi

Call:
lm(formula = mpg ~ cyl + disp + hp + wt + am, data = mtcars)

Coefficients:
(Intercept)          cyl         disp           hp           wt  
   38.20280     -1.10638      0.01226     -0.02796     -3.30262  
   amManual  
    1.55649  

Residuals and Diagnostics

par(mfrow = c(2,2))
plot(rm_multi, main = "Figure 2: Residuals and Diagnostics")

plot of chunk unnamed-chunk-4