attach(car.test.frame) auto.tree <- tree(Mileage~Weight+Type, car.test.frame) plot(auto.tree, type="u") text(auto.tree) title("A Tree-Based Model\nfor Mileage versus gals") summary(auto.tree) predict(auto.tree) plot(prune.tree(auto.tree)) the above command shows deviance decreasing as a function of the number of nodes and the cost-complexity parameter k. plot(prune.tree(auto.tree, k=25)) text(prune.tree(auto.tree, k=25)) summary(prune.tree(auto.tree, k=25)) attach(kyphosis) kyph.tree <- tree(Kyphosis~ Age + Number + Start, data=kyphosis) plot(kyph.tree, type="u") text(kyph.tree) plot(shrink.tree(kyph.tree)) kyph.tree.sh.25 <-shrink.tree(kyph.tree, k=0.25) plot(kyph.tree.sh.25) text(kyph.tree.sh.25) summary(kyph.tree.sh.25) kyph.tree.sh.25