Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- frmla <- bad_econ ~ blah1 + blah2 + blah3 + [etc...]
- fit = rpart(frmla, method='class', data=datas)
- printcp(fit) # display the results
- plotcp(fit) # visualize cross-validation results
- summary(fit) # detailed summary of splits
- fit
- pred = predict(fit)
- table(pred, datas$bad_econ)
- pred 0 1
- 0 x y
- 1 z a
- pred 0 1
- 0 8 0
- 0.2 4 1
- 0.333333333333333 8 4
- 0.4 6 4
- 0.666666666666667 5 10
- 0.714285714285714 2 5
- 0.782608695652174 5 18
- 0.8 1 4
- 0.857142857142857 1 6
- 0.928571428571429 1 13
- 1 0 93
- Residual mean deviance: 0.09359 = 17.13 / 183
- Distribution of residuals:
- Min. 1st Qu. Median Mean 3rd Qu. Max.
- -0.9286 0.0000 0.0000 0.0000 0.1429 0.8000
- pred = predict(fit, type = "class")
- table(pred, datas$bad_econ)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement