11.07.2015 Views

Preface to First Edition - lib

Preface to First Edition - lib

Preface to First Edition - lib

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

166 RECURSIVE PARTITIONINGR> <strong>lib</strong>rary("partykit")R> plot(as.party(bodyfat_rpart), tp_args = list(id = FALSE))1waistcirc2hipcirc< 88.4 >= 88.49kneebreadth< 96.25 >= 96.25< 11.15 >= 11.153610agewaistcirchipcirc< 59.5 >= 59.5< 80.75 >= 80.75< 109.9 >= 109.9n = 11n = 6n = 13n = 10n = 13n = 15n = 3605040302010605040302010605040302010605040302010605040302010605040302010605040302010Figure 9.1Initial tree for the body fat data with the distribution of body fat interminal nodes visualised via boxplots.To determine if the tree is appropriate or if some of the branches need <strong>to</strong>be subjected <strong>to</strong> pruning we can use the cptable element of the rpart object:R> print(bodyfat_rpart$cptable)CP nsplit rel error xerror xstd1 0.66289544 0 1.00000000 1.0270918 0.168404242 0.09376252 1 0.33710456 0.4273989 0.094300243 0.07703606 2 0.24334204 0.4449342 0.086861504 0.04507506 3 0.16630598 0.3535449 0.069570805 0.01844561 4 0.12123092 0.2642626 0.059745756 0.01818982 5 0.10278532 0.2855892 0.062213937 0.01000000 6 0.08459549 0.2785367 0.06242559R> opt cp bodyfat_prune

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!