MTCARS Data Viz:

Below are additional data visualizations used in the course of the original report.

require(graphics)
pairs(mtcars, main = "mtcars data")

library(ggplot2)

ggplot(mtcars, aes(x=am, y=mpg, fill=am)) + geom_boxplot() + ggtitle("MPG Distribution by Transmission Type")

ggplot(mtcars, aes(x=am, y=wt, fill=am)) + geom_boxplot() + ggtitle("Weight Distribution by Transmission Type")

plot(stepwiseModel)

data(mtcars)
library(psych)
## 
## Attaching package: 'psych'
## 
## The following object is masked from 'package:ggplot2':
## 
##     %+%
pairs.panels(mtcars)

library(corrplot)
mcor<-cor(mtcars)
round(mcor,digits=2)
##        mpg   cyl  disp    hp  drat    wt  qsec    vs    am  gear  carb
## mpg   1.00 -0.85 -0.85 -0.78  0.68 -0.87  0.42  0.66  0.60  0.48 -0.55
## cyl  -0.85  1.00  0.90  0.83 -0.70  0.78 -0.59 -0.81 -0.52 -0.49  0.53
## disp -0.85  0.90  1.00  0.79 -0.71  0.89 -0.43 -0.71 -0.59 -0.56  0.39
## hp   -0.78  0.83  0.79  1.00 -0.45  0.66 -0.71 -0.72 -0.24 -0.13  0.75
## drat  0.68 -0.70 -0.71 -0.45  1.00 -0.71  0.09  0.44  0.71  0.70 -0.09
## wt   -0.87  0.78  0.89  0.66 -0.71  1.00 -0.17 -0.55 -0.69 -0.58  0.43
## qsec  0.42 -0.59 -0.43 -0.71  0.09 -0.17  1.00  0.74 -0.23 -0.21 -0.66
## vs    0.66 -0.81 -0.71 -0.72  0.44 -0.55  0.74  1.00  0.17  0.21 -0.57
## am    0.60 -0.52 -0.59 -0.24  0.71 -0.69 -0.23  0.17  1.00  0.79  0.06
## gear  0.48 -0.49 -0.56 -0.13  0.70 -0.58 -0.21  0.21  0.79  1.00  0.27
## carb -0.55  0.53  0.39  0.75 -0.09  0.43 -0.66 -0.57  0.06  0.27  1.00
corrplot(mcor)

corrplot(mcor,addCoef.col="black", method="shade", shade.col=NA)

library(GGally)
ggpairs(mtcars)

mtcars$cyl <- as.factor(mtcars$cyl)
ggpairs(mtcars, columns = c(1, 5), colour = "cyl", params=list(corSize=12))
## Warning: The plyr::rename operation has created duplicates for the
## following name(s): (`colour`)

ggpairs(mtcars[ ,c("mpg", "wt", "disp", "qsec")], columns = 1:3, size = "qsec")

library(corrgram)
corrgram(mtcars,lower.panel=panel.pie, upper.panel=panel.conf, diag.panel=panel.minmax)