Kumar Mainali
2014-Apr-24 16:44 UTC
[R] mvpart question - how to calculate deviance explained by variables?
library(mvpart)
The r code I used:
mvpart(ept~cond+phlab+doc+episub+embed+woodtot+shade+Q+stgrad+veldpth,
data=mydata, method="anova", xv="1se", xval=5, xvmult=1000)
Part of the tabular output of the tree:
*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 *
Is there a convenient way to calculate the deviance explained by each
variables? For instance, I did it manually for one variable in one split as
below:
the deviance explained by cond *1 – (2857+491)/3905.98 = 0.1426*
Thank you.
- Kumar Mainali
ᐧ
[[alternative HTML version deleted]]