right                 package:locfit                 R Documentation

_O_n_e-_s_i_d_e_d _r_i_g_h_t _s_m_o_o_t_h _f_o_r _a _L_o_c_f_i_t _m_o_d_e_l.

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

     The 'right()' function is used in a locfit model formula to
     specify a one-sided smooth: when fitting at a point x, only data
     points with x_i <= x should be used. This can be useful in
     estimating points of discontinuity, and in cross-validation for
     forecasting a time series.

     When using this function, it will usually be necessary to specify
     an evaluation structure, since the fit is not smooth and locfit's
     interpolation methods are unreliable. Also, it is usually best to
     use 'deg=0' or 'deg=1', otherwise the fits may be too variable. If
     nearest neighbor bandwidth specification is used, it does not
     recognize 'right()'.

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

     right(x)

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

       x: numeric variable.

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

     'lfbas', 'locfit', 'left'

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

     # compute left and right smooths
     data(penny)
     xev <- (1945:1988)+0.5
     fitl <- locfit(thickness~left(year), alpha=c(0,10), deg=1, ev=xev, data=penny)
     fitr <- locfit(thickness~right(year),alpha=c(0,10), deg=1, ev=xev, data=penny)
     # plot the squared difference, to show the change points.
     plot( xev, (predict(fitr,where="ev") - predict(fitl,where="ev"))^2 )

