Predicting car sales

Kim Lindholm
2015/06/15

Libraries

library(tree)
library(ISLR)
attach(Carseats)

Program

High=ifelse(Sales <=8,"No","Yes")
Carseats =data.frame(Carseats ,High)
tree.carseats =tree(High~.-Sales ,data = Carseats )

Summary


Classification tree:
tree(formula = High ~ . - Sales, data = Carseats)
Variables actually used in tree construction:
[1] "ShelveLoc"   "Price"       "Income"      "CompPrice"   "Population" 
[6] "Advertising" "Age"         "US"         
Number of terminal nodes:  27 
Residual mean deviance:  0.4575 = 170.7 / 373 
Misclassification error rate: 0.09 = 36 / 400 

Decision tree

plot of chunk unnamed-chunk-4