[R] robust regression (l1fit)

Martin Maechler maechler at stat.math.ethz.ch
Thu Jun 26 15:17:42 CEST 2003


>>>>> "Roger" == Roger Koenker <roger at ysidro.econ.uiuc.edu>
>>>>>     on Thu, 26 Jun 2003 04:18:27 -0500 (CDT) writes:

    Roger> On Thu, 26 Jun 2003, Martin Maechler wrote:

     >>>>> "BDR" == Prof Brian Ripley <ripley at stats.ox.ac.uk>
     >>>>>     on Wed, 25 Jun 2003 20:06:49 +0100 (BST) writes:

      BDR> On Wed, 25 Jun 2003, Rafael Bertola wrote:
       >> Is there a command in R that make the same regression
       >> like l1fit in S-plus?

      BDR> You can use the quantreg package.
     MM>
     MM> This is an quite-FAQ, really.  Maybe we need a list of
     MM> "quite frequently asked questions" or rather extend the FAQ?
     MM>
     MM> Specifically, I wonder if it wasn't worth to add something
     MM> like the following to the quantreg package
     MM>
     MM>l1fit <- function(x,y, intercept = TRUE)
     MM> {
     MM>   warning("l1fit() in R is just a wrapper to rq().  Use that instead!")
     MM>   if(intercept)  rq(y ~ x, tau = 0.5)
     MM>   else  rq(y ~ x - 1, tau = 0.5)
     MM> }
     MM>
     MM> (and an \alias{l1fit} to the rq.Rd help page) So at least
     MM> all who have quantreg installed will find l1fit

    Roger> I'd be happy to add such a function, but I rather
    Roger> doubt that it would reduce the incidence of such
    Roger> questions.  Putting a function like Martin's in base
    Roger> with the warning replaced by require(quantreg) might
    Roger> be more effective.

I agree this would be even more effective.
I'm not sure the R core team would on doing this.
require()ing packages {apart from base+recommended} is not liked
for other good reasons.

    Roger> Of course, in Splus l1fit returns
    Roger> only coefficients and residuals without any attempt
    Roger> to do any inference, so one might also want to
    Roger> further restrict the output of rq() for full
    Roger> compatibility.

I wouldn't want to do this.  l1fit() is really from the days of
"S 2", i.e. no formulae, no (S3) classes/methods.
Telling users to upgrade their code from using l1fit() to using
rq() seems better to me.

OTOH, if you (or anyone else would provide code (*.R) and
documentation (*.Rd) for such an l1fit(), we'd probably accept
it, for the "modreg" package probably (rather than "base").


      BDR> However, neither l1fit nor that do `robust regression',
      BDR> so you need to think more carefully about what you
      BDR> really want.  There are almost always better
      BDR> alternatives than L1 fits.

     MM> I "fervently" agree.
     MM>
     MM> Most notably, the
     MM>     rlm() {Robust Linear Models}
     MM>
     MM> in package MASS (Venables and Ripley)!

    Roger> Without wanting to get involved in any religious wars
    Roger> about robustness, I would simply observe that Brian's
    Roger> comment applies to life in general: there are almost
    Roger> always better alternatives to [any specified
    Roger> procedure].  So until someone produces a very
    Roger> convincing argument for the universal applicability
    Roger> of one particular procedure for robust regression, I
    Roger> would plea for "letting 100 flowers bloom and 100
    Roger> schools of thought contend."

(since we don't want to get into any religious wars .... I keep shut)

Martin




More information about the R-help mailing list