Lab 4G
Directions: Follow along with the slides and answer the questions in red font in your journal.
titanic data.tree() function to create a classification tree that predicts whether a person survived the Titanic based on their gender.
tree is similar to that of the lm() function.tree1.survived or not based on their gender?tree1, place the model into the treeplot function.
treeplot:
gender does the model predict will survive?tree that predicts whether a person survived based on their gender, age, class, and where they embarked.
tree2.treeplot for this model and answer the following question:
tree?tree() function will fit a tree model that will make good predictions without needing lots of branches.cp, which equals 0.01 by default.minsplit, which equals 20 by default.tree2, create a model named tree3 but include cp = 0.005 and minsplit = 10 as arguments.
tree3 different from tree2?data function to load the titanic_test data.titanic_test data survived or not using tree1.tree1, tree2 or tree3) had the lowest misclassification rate for the titanic_test data?tree2. This time though, change the complexity parameter to 0.0001. Then answer the following