Hi. I am having trouble understanding why the following table shows me zero Predicted Yes (present): Thank you
kyphosis is a type of deformation after surgery
age is in months, number is number of vertebrae, start is highest vertebrae operated on
library(rpart)
df <- kyphosis
set.seed(1)
mytree <- rpart(Kyphosis ~ Age + Number + Start, data = df, method="class")
predicted <- predict(mytree, type="class")
t <- data.frame(df$Kyphosis,predicted[2])
colnames(t) <- c("Actual", "Predicted")
tab <- table(t)
rownames(tab) <- c("Actual no","Actual yes")
colnames(tab) <- c("Predicted no", "Predicted yes")
summary(df$Kyphosis) # shows 64 absent, 17 present
summary(predicted) # shows 55 absent, 26 present
tab # shows all 81 Predicted no (absent), 0 Predicted yes (present)