Advertisement
Guest User

Untitled

a guest
Jul 30th, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. frmla <- bad_econ ~ blah1 + blah2 + blah3 + [etc...]
  2.  
  3. fit = rpart(frmla, method='class', data=datas)
  4.  
  5. printcp(fit) # display the results
  6. plotcp(fit) # visualize cross-validation results
  7. summary(fit) # detailed summary of splits
  8. fit
  9.  
  10. pred = predict(fit)
  11. table(pred, datas$bad_econ)
  12.  
  13. pred 0 1
  14. 0 x y
  15. 1 z a
  16.  
  17. pred 0 1
  18. 0 8 0
  19. 0.2 4 1
  20. 0.333333333333333 8 4
  21. 0.4 6 4
  22. 0.666666666666667 5 10
  23. 0.714285714285714 2 5
  24. 0.782608695652174 5 18
  25. 0.8 1 4
  26. 0.857142857142857 1 6
  27. 0.928571428571429 1 13
  28. 1 0 93
  29.  
  30. Residual mean deviance: 0.09359 = 17.13 / 183
  31. Distribution of residuals:
  32. Min. 1st Qu. Median Mean 3rd Qu. Max.
  33. -0.9286 0.0000 0.0000 0.0000 0.1429 0.8000
  34.  
  35. pred = predict(fit, type = "class")
  36. table(pred, datas$bad_econ)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement