printcp                package:rpart                R Documentation

_D_i_s_p_l_a_y_s _C_P _t_a_b_l_e _f_o_r _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:

     Displays the 'cp' table for fitted 'rpart' object.

_U_s_a_g_e:

     printcp(x, digits=getOption("digits") - 2)

_A_r_g_u_m_e_n_t_s:

       x: fitted model object of class 'rpart'.  This is assumed to be
          the result  of some function that produces an object with the
          same named  components as that returned by the 'rpart'
          function.  

  digits: the number of digits of numbers to print. 

_D_e_t_a_i_l_s:

     Prints a table of optimal prunings based on a complexity
     parameter.

_S_e_e _A_l_s_o:

     'summary.rpart',  'rpart.object'

_E_x_a_m_p_l_e_s:

     data(car.test.frame)
     z.auto <- rpart(Mileage ~ Weight, car.test.frame)
     printcp(z.auto)
     ## Not run: 
     Regression tree:
     rpart(formula = Mileage ~ Weight, data = car.test.frame)

     Variables actually used in tree construction:
     [1] Weight

     Root node error: 1354.6/60 = 22.576

             CP nsplit rel error  xerror     xstd 
     1 0.595349      0   1.00000 1.03436 0.178526
     2 0.134528      1   0.40465 0.60508 0.105217
     3 0.012828      2   0.27012 0.45153 0.083330
     4 0.010000      3   0.25729 0.44826 0.076998
     ## End(Not run)

