ksmooth                package: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)

