robustSmoothSpline        package:aroma.light        R Documentation

_R_o_b_u_s_t _f_i_t _o_f _a _S_m_o_o_t_h_i_n_g _S_p_l_i_n_e

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

     Fits a smoothing spline robustly using the L_1 norm. Currently,
     the algorithm is an _iterative reweighted smooth spline_ algorithm
     which calls 'smooth.spline(x,y,w,...)' at each iteration with the
     weights 'w' equal to the inverse of the absolute value of the
     residuals for the last iteration step.

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

     ## Default S3 method:
     robustSmoothSpline(x, y=NULL, w=NULL, ..., minIter=3, maxIter=max(minIter, 50), sdCriteria=2e-04, reps=1e-15, plotCurves=FALSE)

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

       x: a 'vector' giving the values of the predictor variable, or a
          'list' or a two-column 'matrix' specifying 'x' and 'y'. If
          'x' is of class 'smooth.spline' then 'x$x' is used as the 'x'
          values and 'x$yin' are used as the 'y' values.

       y: responses. If 'y' is missing, the responses are assumed to be
          specified by 'x'.

       w: a 'vector' of weights the same length as 'x' giving the
          weights to use for each element of 'x'. Default value is
          equal weight to all values.

     ...: Other arguments passed to 'smooth.spline'.

 minIter: the minimum number of iterations used to fit the smoothing
          spline robustly. Default value is 3.

 maxIter: the maximum number of iterations used to fit the smoothing
          spline robustly. Default value is 25.

sdCriteria: Convergence criteria, which the difference between the
          standard deviation of the residuals between two consecutive
          iteration steps. Default value is 2e-4.

    reps: Small positive number added to residuals to avoid division by
          zero when calculating new weights for next iteration.

plotCurves: If 'TRUE', the fitted splines are added to the current
          plot, otherwise not.

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

     Returns an object of class 'smooth.spline'.

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

     Henrik Bengtsson (<URL: http://www.braju.com/R/>)

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

     'smooth.spline'.

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

     data(cars)
     attach(cars)
     plot(speed, dist, main = "data(cars)  &  robust smoothing splines")

     # Fit a smoothing spline using L_2 norm
     cars.spl <- smooth.spline(speed, dist)
     lines(cars.spl, col = "blue")

     # Fit a smoothing spline using L_1 norm
     cars.rspl <- robustSmoothSpline(speed, dist)
     lines(cars.rspl, col = "red")

     # Fit a smoothing spline using L_2 norm with 10 degrees of freedom
     lines(smooth.spline(speed, dist, df=10), lty=2, col = "blue")

     # Fit a smoothing spline using L_1 norm with 10 degrees of freedom
     lines(robustSmoothSpline(speed, dist, df=10), lty=2, col = "red")

     legend(5,120, c(
         paste("smooth.spline [C.V.] => df =",round(cars.spl$df,1)),
         paste("robustSmoothSpline [C.V.] => df =",round(cars.rspl$df,1)),
         "standard with s( * , df = 10)", "robust with s( * , df = 10)"
       ), col = c("blue","red","blue","red"), lty = c(1,1,2,2), bg='bisque')

