residuals.rpart            package:rpart            R Documentation

_R_e_s_i_d_u_a_l_s _F_r_o_m _a _F_i_t_t_e_d _R_p_a_r_t _O_b_j_e_c_t

_D_e_s_c_r_i_p_t_i_o_n:

     Method for 'residuals' for an 'rpart' object.

_U_s_a_g_e:

     ## S3 method for class 'rpart':
     residuals(object, type = c("usual", "pearson", "deviance"), ...)

_A_r_g_u_m_e_n_t_s:

  object: fitted model object of class '"rpart"'. 

    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).

          For 'poisson' and 'exp' (or survival) trees, the 'usual'
          residual is the observed - expected number of events. The
          'pearson' and 'deviance' residuals are as defined in
          McCullagh and Nelder. 

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

_V_a_l_u_e:

     vector of residuals of type 'type' from a fitted 'rpart' object.

_R_e_f_e_r_e_n_c_e_s:

     McCullagh P. and Nelder, J. A. (1989) _Generalized Linear Models_.
     London: Chapman and Hall.

_E_x_a_m_p_l_e_s:

     fit <- rpart(skips ~ Opening + Solder + Mask + PadType + Panel,
            data=solder, method='anova')
     summary(residuals(fit))
     plot(predict(fit),residuals(fit))

