loessFit                package:limma                R Documentation

_F_a_s_t _S_i_m_p_l_e _L_o_e_s_s

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

     A fast version of locally weighted regression when there is only
     one x-variable and only the fitted values and residuals are
     required.

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

     loessFit(y, x, weights=NULL, span=0.3, bin=0.01/(2-is.null(weights)), iterations=4)

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

       y: numeric vector of response values.  Missing values are
          allowed.

       x: numeric vector of predictor values  Missing values are
          allowed.

 weights: numeric vector of non-negative weights.  Missing values are
          allowed.

    span: numeric parameter between 0 and 1 specifying proportion of
          data to be used in the local regression moving window. Larger
          numbers give smoother fits.

     bin: numeric value between 0 and 1 giving the proportion of the
          data which can be grouped in a single bin when doing local
          regression fit. 'bin=0' forces an exact local regression fit
          with no interpolation.

iterations: number of iterations of loess fit

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

     This function is a low-level equivalent to 'lowess' in the stats
     package if 'weights' is null and to 'loess' otherwise. It is
     intended to give a streamlined common interface to the two
     functions for use in 'normalizeWithinArrays'. Note that, while
     'lowess' has fewer features than 'loess', it is faster, uses less
     memory and uses a more accurate interpolation scheme than 'loess',
     so it is desirable to use 'lowess' whenever the extra features of
     'loess' are not required.

     There are a couple of key differences between 'loessFit' and
     'loess' when 'weights' is non-NULL. One difference is that
     'loessFit' returns a linear regression fit if there are
     insufficient observations to estimate the loess curve, whereas
     'loess' will return an error.

     The arguments 'span', 'cell' and 'iterations' here have the same
     meaning as in 'loess'. 'span' is equivalent to the argument 'f' of
     'lowess' and 'iterations' is equivalent to 'iter+1'. The parameter
     'bin' is intended to give a simple uniform interface to the
     'delta' argument of 'lowess' and the 'cell' argument of 'loess'.
     'bin' translates to 'delta=bin*diff(range(x))' in a call to
     'lowess' or to 'cell=bin/span' in a call to 'loess'.

     Unlike 'lowess', 'loessFit' returns values in original rather than
     sorted order. Also unlike 'lowess', 'loessFit' allows missing
     values, the treatment being analogous to 'na.exclude'.

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

     A list with components 

  fitted: numeric vector of same length as 'y' giving the loess fit

residuals: numeric vector of same length as 'x' giving residuals from
          the fit

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

     Gordon Smyth

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

     An overview of LIMMA functions for normalization is given in
     05.Normalization.

     See also 'lowess' and 'loess' in the stats package.

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

     y <- rnorm(1000)
     x <- rnorm(1000)
     w <- rep(1,1000)
     # The following are equivalent apart from execution time
     # and interpolation inaccuracies
     system.time(fit <- loessFit(y,x)$fitted)
     system.time(fit <- loessFit(y,x,w)$fitted)
     system.time(fit <- fitted(loess(y~x,weights=w,span=0.3,family="symmetric",iterations=4)))
     # The same but with sorted x-values
     system.time(fit <- lowess(x,y,f=0.3)$y)

