Kim Lindholm
2015/06/15
library(tree)
library(ISLR)
attach(Carseats)
High=ifelse(Sales <=8,"No","Yes")
Carseats =data.frame(Carseats ,High)
tree.carseats =tree(High~.-Sales ,data = Carseats )
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