Kumar Mainali
2014-Apr-22 08:25 UTC
[R] mvpart - easy way to calculate deviance explained by variables
Dear R-users, I can use mvpart function of library "mvpart" to get a decision tree. The output of decision tree could be something like the following. I can use it to manually calculate deviance explained by the variable in the first split as below. There should be an easy way to tabulate deviance explained by all variables. I cannot seem to find it. The function printcp gives you a nice table with rel error which you can use to estimate R^2. But printcp gives output for variously sized trees, not for variables entered into the model. - Kumar Mainali the deviance explained by cond *1 – (2857+491)/3905.98 = 0.1426 or 14.26%.* * 1) root 295 3905.9860 4.806780 * * 2) cond>=194.15 77 491.2468 2.493506 * 4) cond>=309.7 25 62.1600 1.440000 * 5) cond< 309.7 52 388.0000 3.000000 * * 3) cond< 194.15 218 2857.1560 5.623853 * *6) embed>=82.5 114 891.9649 4.017544 * * ...........................................* Graduate Program in Ecology, Evolution and Behavior The University of Texas at Austin | Austin, Texas 78712, USA ᐧ [[alternative HTML version deleted]]