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.

R-square<br />

0.0 0.2 0.4 0.6 0.8 1.0<br />

•<br />

•<br />

•<br />

Apparent<br />

X Relative<br />

•<br />

• •<br />

•<br />

•<br />

•<br />

X Relative Error<br />

0.4 0.6 0.8 1.0 1.2<br />

•<br />

•<br />

• •<br />

•<br />

0 1 2 3 4 5<br />

Number of Splits<br />

0 1 2 3 4 5<br />

Number of Splits<br />

Figure 8: Both plots were obtained using <strong>the</strong> function rsq.rpart(fit3). The gure<br />

on <strong>the</strong> left shows that <strong>the</strong> rst split oers <strong>the</strong> most information. The gure on <strong>the</strong><br />

right suggests that <strong>the</strong> tree should be pruned <strong>to</strong> include only 1 or 2 splits.<br />

useful plot is <strong>the</strong> R 2 versus number of splits. The (1 - apparent error) and (1 -<br />

relative error) show howmuch is gained with additional splits. This plot highlights<br />

<strong>the</strong> dierences between <strong>the</strong> R 2 values (gure 9).<br />

Finally, it is possible <strong>to</strong> look at <strong>the</strong> residuals from this model, just as with a<br />

regular linear regression t, as shown in <strong>the</strong> following gure.<br />

> plot(predict(fit3),resid(fit3))<br />

> axis(3,at=fit3$frame$yval[fit3$frame$var==''],<br />

labels=row.names(fit3$frame)[fit3$frame$var==''])<br />

> mtext('leaf number',side=3, line=3)<br />

> abline(h=0)<br />

6.3 Solder data (poisson method)<br />

The solder data frame, as explained in <strong>the</strong> Splus help le, is a design object with 900<br />

observations, which are <strong>the</strong> results of an experimentvarying 5 fac<strong>to</strong>rs relevant <strong>to</strong> <strong>the</strong><br />

wave-soldering procedure for mounting components on printed circuit boards. The<br />

response variable, skips, is a count of how many solder skips appeared <strong>to</strong> a visual<br />

inspection. The o<strong>the</strong>r variables are listed below:<br />

23

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

Saved successfully!

Ooh no, something went wrong!