print("CART - Example 10.7")
summary(monica)
pause()
library(rpart)
monica.rpart <- rpart(outcome ~ ., data = monica, cp = 0.0025)
plotcp(monica.rpart)
printcp(monica.rpart)
pause()
monicab.rpart <- prune(monica.rpart, cp=0.006)
print(monicab.rpart)
summary(mifem)
pause()
mifem.rpart <- rpart(outcome ~ ., data = mifem, cp = 0.0025)
plotcp(mifem.rpart)
printcp(mifem.rpart)
pause()
mifemb.rpart <- prune(mifem.rpart, cp=0.006)
print(mifemb.rpart)
Run the code above in your browser using DataLab