

nnbr(sm)                                     R Documentation

_n_e_a_r_e_s_t _n_e_i_g_h_b_o_u_r _d_i_s_t_a_n_c_e_s _f_r_o_m _d_a_t_a _i_n _o_n_e _o_r _t_w_o _d_i_m_e_n_-
_s_i_o_n_s

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

     This function calculates the `k' nearest neighbour dis-
     tance from each value in `x' to the remainder of the
     data.  In two dimensions, Euclidean distance is used
     after standardising the data to have unit variance in
     each component.

_U_s_a_g_e_:

     nnbr(x, k)

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

       x: the vector, or two-column matrix, of data.

       k: the required order of nearest neighbour.

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

     see Section 1.7.1 of the reference below.

_V_a_l_u_e_:

     the vector of nearest neighbour distances.

_S_i_d_e _E_f_f_e_c_t_s_:

     none.

_R_e_f_e_r_e_n_c_e_s_:

     Bowman, A.W. and Azzalini, A. (1997). Applied Smoothing
     Techniques for Data Analysis: the Kernel Approach with
     S-Plus Illustrations.  Oxford University Press, Oxford.

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

     none.

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

     x  <- rnorm(50)
     hw <- nnbr(x, 10)
     hw <- hw/exp(mean(log(hw)))
     sm.density(x, h.weights=hw)

