margin             package:randomForest             R Documentation

_M_a_r_g_i_n_s _o_f _r_a_n_d_o_m_F_o_r_e_s_t _C_l_a_s_s_i_f_i_e_r

_D_e_s_c_r_i_p_t_i_o_n:

     Compute or plot the margin of predictions from a randomForest
     classifier.

_U_s_a_g_e:

     ## S3 method for class 'randomForest':
     margin(x, ...)
     ## Default S3 method:
     margin(x, observed, ...)
     ## S3 method for class 'margin':
     plot(x, sort=TRUE, ...)

_A_r_g_u_m_e_n_t_s:

       x: an object of class 'randomForest', whose 'type' is not
          'regression', or a matrix of predicted probabilities, one
          column per class and one row per observation. For the 'plot'
          method, 'x' should be an object returned by 'margin'.

observed: the true response corresponding to the data in 'x'.

    sort: Should the data be sorted by their class labels?

     ...: other graphical parameters to be passed to 'plot.default'.

_V_a_l_u_e:

     For 'margin', the _margin_ of observations from the 'randomForest'
     classifier (or whatever classifier that produced the predicted
     probability matrix given to 'margin'). The margin of a data point
     is defined as the proportion of votes for the correct class minus
     maximum proportion of votes for the other classes.  Thus under
     majority votes, positive margin means correct classification, and
     vice versa.

_A_u_t_h_o_r(_s):

     Robert Gentlemen, with slight modifications by Andy Liaw

_S_e_e _A_l_s_o:

     'randomForest'

_E_x_a_m_p_l_e_s:

     set.seed(1)
     data(iris)
     iris.rf <- randomForest(Species ~ ., iris, keep.forest=FALSE)
     plot(margin(iris.rf))

