First, install and load latest version of FFTrees from GitHub

#devtools::install_github("ndphillips/FFTrees")
library(FFTrees)

Step 1: Create training and test data

# Step 1: Create training and test data

set.seed(100)

heartdisease <- heartdisease[sample(nrow(heartdisease)),]
heart.train <- heartdisease[1:150,]
heart.test <- heartdisease[151:303,]

Step 2: Create heart.fft

# Step 2: Create heart.fft
heart.fft <- FFTrees(formula = diagnosis ~.,
                     data = heart.train,
                     data.test = heart.test)

Step 3: Create summary statistics

# Step 3: Summary statistics

# print(heart.fft)
heart.fft
## [1] "7 trees using 4 predictors {thal,cp,ca,oldpeak}"
## [1] "FFTrees AUC: (Train = 0.88, Test = 0.89)"
## [1] "My favorite training tree is #4, here is how it performed:"
##                         train   test
## n                      150.00 153.00
## p(Correct)               0.80   0.82
## Hit Rate (HR)            0.82   0.88
## False Alarm Rate (FAR)   0.21   0.24
## d-prime                  1.70   1.87
# summary

summary(heart.fft)
## $train
##   tree               cues nodes                             classes
## 1    1 thal;cp;ca;oldpeak     4 character;character;numeric;numeric
## 2    2         thal;cp;ca     3         character;character;numeric
## 3    3         thal;cp;ca     3         character;character;numeric
## 4    4         thal;cp;ca     3         character;character;numeric
## 5    5 thal;cp;ca;oldpeak     4 character;character;numeric;numeric
## 6    6 thal;cp;ca;oldpeak     4 character;character;numeric;numeric
## 7    7 thal;cp;ca;oldpeak     4 character;character;numeric;numeric
##       exits     thresholds directions   n hi mi fa cr        hr        far
## 1 0;0;0;0.5 rd,fd;a;1;0.93  =;=;>=;>= 150 21 45  0 84 0.3181818 0.00000000
## 2   0;0;0.5      rd,fd;a;1     =;=;>= 150 28 38  2 82 0.4242424 0.02380952
## 3   0;1;0.5      rd,fd;a;1     =;=;>= 150 44 22  7 77 0.6666667 0.08333333
## 4   1;0;0.5      rd,fd;a;1     =;=;>= 150 54 12 18 66 0.8181818 0.21428571
## 5 1;0;1;0.5 rd,fd;a;1;0.93  =;=;>=;>= 150 56 10 21 63 0.8484848 0.25000000
## 6 1;1;0;0.5 rd,fd;a;1;0.93  =;=;>=;>= 150 59  7 32 52 0.8939394 0.38095238
## 7 1;1;1;0.5 rd,fd;a;1;0.93  =;=;>=;>= 150 64  2 52 32 0.9696970 0.61904762
##           v   dprime
## 1 0.3181818      Inf
## 2 0.4004329 1.789700
## 3 0.5833333 1.813721
## 4 0.6038961 1.700096
## 5 0.5984848 1.704447
## 6 0.5129870 1.550734
## 7 0.3506494 1.573378
## 
## $test
##   tree               cues nodes                             classes
## 1    1 thal;cp;ca;oldpeak     4 character;character;numeric;numeric
## 2    2         thal;cp;ca     3         character;character;numeric
## 3    3         thal;cp;ca     3         character;character;numeric
## 4    4         thal;cp;ca     3         character;character;numeric
## 5    5 thal;cp;ca;oldpeak     4 character;character;numeric;numeric
## 6    6 thal;cp;ca;oldpeak     4 character;character;numeric;numeric
## 7    7 thal;cp;ca;oldpeak     4 character;character;numeric;numeric
##       exits     thresholds directions   n hi mi fa cr        hr    far
## 1 0;0;0;0.5 rd,fd;a;1;0.93  =;=;>=;>= 153 23 50  0 80 0.3150685 0.0000
## 2   0;0;0.5      rd,fd;a;1     =;=;>= 153 28 45  0 80 0.3835616 0.0000
## 3   0;1;0.5      rd,fd;a;1     =;=;>= 153 49 24  8 72 0.6712329 0.1000
## 4   1;0;0.5      rd,fd;a;1     =;=;>= 153 64  9 19 61 0.8767123 0.2375
## 5 1;0;1;0.5 rd,fd;a;1;0.93  =;=;>=;>= 153 66  7 24 56 0.9041096 0.3000
## 6 1;1;0;0.5 rd,fd;a;1;0.93  =;=;>=;>= 153 69  4 35 45 0.9452055 0.4375
## 7 1;1;1;0.5 rd,fd;a;1;0.93  =;=;>=;>= 153 72  1 56 24 0.9863014 0.7000
##           v   dprime
## 1 0.3150685      Inf
## 2 0.3835616      Inf
## 3 0.5712329 1.724872
## 4 0.6392123 1.873075
## 5 0.6041096 1.829730
## 6 0.5077055 1.757354
## 7 0.2863014 1.681410

Step 4: Plot the tree and cue accuracies

# Step 4a: Plot tree
plot(heart.fft, data = "test")

# Step 4b: Plot cue accuracies
plot(heart.fft, what = "cues", main = "Heart Disease")