#grow an mixture tree on the Pima Indian dataset
data(Pima.tr, package = "MASS")
ob.tree <- oblique.tree(formula = type~.,
data = Pima.tr,
oblique.splits = "on")
plot(ob.tree);text(ob.tree);title(main="Mixture Tree")
#examine the tree sequence
tree.seq <- prune.oblique.tree( tree = ob.tree)
print(tree.seq);plot(tree.seq)
#examine test error over the tree sequence
data(Pima.te, package = "MASS")
tree.seq <- prune.oblique.tree( tree = ob.tree,
newdata = Pima.te)
print(tree.seq);plot(tree.seq)
#deviance is least when k = 8.148267
pruned <- prune.oblique.tree( tree = ob.tree,
k = 9)
plot(pruned);text(pruned);title(main="Pruned Tree")
Run the code above in your browser using DataLab