28.08.2014 Views

An Introduction to Recursive Partitioning Using the RPART Routines ...

An Introduction to Recursive Partitioning Using the RPART Routines ...

An Introduction to Recursive Partitioning Using the RPART Routines ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

summary(fit)<br />

Step{VI. Plot a standard version of <strong>the</strong> plot with some basic information.<br />

plot(fit)<br />

text(fit,use.n=T)<br />

Step{VII. Create a prettier version of <strong>the</strong> tree.<br />

post(fit,file="")<br />

3 Rpart model options<br />

This section examines <strong>the</strong> various options that are available when tting <strong>the</strong> model<br />

rpart. The options are listed below with a brief explanation, <strong>the</strong>n explored fur<strong>the</strong>r<br />

with actual examples.<br />

The central tting function is rpart, whose main arguments are<br />

formula: <strong>the</strong> model formula, as in lm and o<strong>the</strong>r S model tting functions. The<br />

right hand side may contain both continuous and categorical (fac<strong>to</strong>r) terms.<br />

If <strong>the</strong> outcome y has more than two levels, <strong>the</strong>n categorical predic<strong>to</strong>rs must<br />

be t by exhaustive enumeration, which can take avery long time.<br />

data, weights, subset: as for o<strong>the</strong>r S models.<br />

method: <strong>the</strong> type of splitting rule <strong>to</strong> use. Options at this point are classication,<br />

anova, Poisson, and exponential.<br />

parms: a list of method specic optional parameters. Poisson splitting has a single<br />

parameter, <strong>the</strong> coecient of variation of <strong>the</strong> prior distribution on <strong>the</strong> rates<br />

(shrink). It is used <strong>to</strong> prevent problems if nodes end up with 0 events. Usually<br />

not changed (default=1). For classication, <strong>the</strong> list can contain any of:<br />

prior{ <strong>the</strong>vec<strong>to</strong>r of prior probabilities<br />

loss{ <strong>the</strong> loss matrix<br />

split{ <strong>the</strong> splitting index<br />

The priors must be positive and sum <strong>to</strong> 1. The loss matrix must have zeros<br />

on <strong>the</strong> diagonal and positive o-diagonal elements. The splitting index can be<br />

`gini' or `information'.<br />

4

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

Saved successfully!

Ooh no, something went wrong!