Learn R Programming

itree (version 0.1)

residuals.itree: Residuals From a Fitted itree Object

Description

Method for residuals for an itree object. This function is used and functions identically to predict.rpart even for procedures unique to itree. Note however that itree is missing the procedures implemented by rpart that are specific to the poisson and exp methods.

Usage

"residuals"(object, type = c("usual", "pearson", "deviance"), ...)

Arguments

object
fitted model object of class "itree".
type
Indicates the type of residual desired.

For regression or anova trees all three residual definitions reduce to y - fitted. This is the residual returned for user method trees as well.

For classification trees the usual residuals are the misclassification losses L(actual, predicted) where L is the loss matrix. With default losses this residual is 0/1 for correct/incorrect classification. The pearson residual is (1-fitted)/sqrt(fitted(1-fitted)) and the deviance residual is sqrt(minus twice logarithm of fitted).

...
further arguments passed to or from other methods.

Value

Vector of residuals of type type from a fitted itree object.

Examples

Run this code
#the rpart example:
fit <- itree(skips ~ Opening + Solder + Mask + PadType + Panel,
       data=solder, method='anova')
summary(residuals(fit))
plot(predict(fit),residuals(fit))

Run the code above in your browser using DataLab