getnbrs                package:adlift                R Documentation

_g_e_t_n_b_r_s

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

     This function uses the user's neighbourhood configuration input to
     find the neighbours of the lifted datapoint to be used in the
     prediction step of the transform.

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

     getnbrs(X, remove, pointsin, neighbours, closest)

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

       X: The vector of gridpoints.

  remove: the index (into 'X') of the point to be removed.

pointsin: The indices of gridpoints still to be removed.

neighbours: the number of neighbours to find for use in prediction.

 closest: Boolean argument: If FALSE, the neighbours selected are the
          ones on both sides of the removed point.

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

     The function uses the value of 'neighbours' and 'closest' to
     choose the neighbours to return. If 'closest' is FALSE, 'pointsin'
     is used to find 'neighbours' indices on both sides of the index of
     the removed point ('remove'). If 'closest' is TRUE, then the
     function uses the gridpoint vector ('X') to calculate distances
     from the removed point to 'neighbours' neighbours on each side of
     the removed point (if they exist) and then uses this information
     to choose the closest 'neighbours' ones, recording where they lie
     in relation to the removed point, and accordingly their index can
     be obtained. If the removed point is on the boundary, then by
     choice, we take only one neighbour.

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

    nbrs: the indices of the neighbours corresponding to the specified
          configuration.

   index: the indices into 'pointsin' of the neighbours

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

     Matt Nunes (matt.nunes@bristol.ac.uk), Marina Popa
     (Marina.Popa@bristol.ac.uk)

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

     'fwtnp'

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

     x1<-runif(20)
     #
     x1
     #
     y1<-make.signal2("bumps",x=x1)
     #
     y1
     #
     order(x1)
     #
     # shows where the points lie in relation to each other.
     #
     neigh<-getnbrs(x1,3,order(x1),4,TRUE)
     #
     neigh$nbrs
     #
     # these are the indices of the 4 closest neighbours to point 3.
     #

