ipredknn                package:ipred                R Documentation

_k-_N_e_a_r_e_s_t _N_e_i_g_h_b_o_u_r _C_l_a_s_s_i_f_i_c_a_t_i_o_n

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

     $k$-nearest neighbour classification with an interface compatible
     to  'bagging' and 'errorest'.

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

     ipredknn(formula, data, subset, na.action, k=5, ...)

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

 formula: a formula of the form 'lhs ~ rhs' where 'lhs'  is the
          response variable and 'rhs' a set of predictors.

    data: optional data frame containing the variables in the model
          formula.

  subset: optional vector specifying a subset of observations to be
          used.

na.action: function which indicates what should happen when the data
          contain 'NA's.

       k: number of neighbours considered, defaults to 5.

     ...: additional parameters.

_D_e_t_a_i_l_s:

     This is a wrapper to 'knn' in order to be able to  use k-NN in
     'bagging' and 'errorest'.

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

     An object of class 'ipredknn'. See 'predict.ipredknn'.

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

     Torsten.Hothorn <Torsten.Hothorn@rzmail.uni-erlangen.de>

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

     learn <- as.data.frame(mlbench.twonorm(300))

     mypredict.knn <- function(object, newdata) 
                        predict.ipredknn(object, newdata, type="class")

     errorest(classes ~., data=learn, model=ipredknn, 
              predict=mypredict.knn)

