

ksmooth {modreg}                             R Documentation

_K_e_r_n_e_l _R_e_g_r_e_s_s_i_o_n _S_m_o_o_t_h_e_r

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

     The Nadaraya-Watson kernel regression estimate.

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

     ksmooth(x, y, kernel = c("box", "normal"), bandwidth = 0.5,
             range.x = range(x), n.points = max(100, length(x)), x.points)

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

       x: input x values

       y: input y values

  kernel: The kernel to be used.

bandwidth: the bandwidth. The kernels are scaled so that
          their quartiles (viewed as probability densities)
          are at `+/-0.25*bandwidth'.

 range.x: the range of points to be covered in the output.

n.points: the number of points at which to evaluate the fit.

x.points: points at which to evaluate the smoothed fit. If
          missing, `n.points' are chosen uniformly to cover
          `range.x'.

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

     A list with components

       x: values at which the smoothed fit is evaluated.
          Guaranteed to be in increasing order.

       y: fitted values corresponding to `x'.

_N_o_t_e_:

     This function is implemented purely for compatibility
     with S, although it is nowhere near as slow as the S
     function. Better kernel smoothers are available in
     other packages.

_A_u_t_h_o_r_(_s_)_:

     B. D. Ripley

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

     data(cars)
     attach(cars)
     plot(speed, dist)
     lines(ksmooth(speed, dist, "normal", bandwidth=2), col=2)
     lines(ksmooth(speed, dist, "normal", bandwidth=5), col=3)
     lines(ksmooth(speed, dist, "normal", bandwidth=10), col=4)

