Please install the package and load the library before starting.
Answers to these exercises are available here.
If you obtained a different (correct) answer than those listed on the solutions page, please feel free to post your answer as a comment on that page.
The FFTree package comes with heart.train/heart.test data. Check the heart.train data and see the diagnosis column. This is our response variable.
Create a FFTree model using heart.test/heart.train and check the summary of the model.
Now, FFTree is understood better by plotting it. Use the plot function to see the plot. Check the probability of a heart attack and the probability of a stable heart.
Create your own custom tree using simple, if else blocks. This allows us to compare different trees with the default tree.
The custom tree should follow this logic:
“if trestbps >180 predict attack
if chol>300 decide heart attack
if age <35 predict stable
if that equals fd or rd, predict attack else stable.”
Plot and summarize the new model; check the confusion matrix. Did you improve the results?
Now, rather than plotting everything, plot just the cues and see how the cues stack up in the FFTree methods.
Plot the same FFTree without the stats. This will help you understand the tree better, without too much information.
You can also print the “best training” tree to see how it is different and how the confusion matrix is different from the tree that is chosen as the default.