[RsR] MASS:rlm() and robustbase::lmrob() are both breaking

Martin Maechler m@ech|er @end|ng |rom @t@t@m@th@ethz@ch
Mon Sep 8 18:10:49 CEST 2008


  [.................]

    MM> Yes; the reason for robustbase::lmrob's failure is basically the
    MM> same as for  MASS::rlm(., method="MM")'s one:

    MM> The MM-method of both require a high-breakdown initial estimate,
    MM> *and* the high-breakdown initial estimates are based algorithms
    MM> that use resampling methods which are not at all adapted to this
    MM> (and based on a theory of affine-invariance which does *not*
    MM> apply in the case of factor-predictors...)

    MM> Within the small community of experts this is well-known.
    MM> For this reason,  Maronna & Yohai (1999) proposed the so-called
    MM> "S/M - estimate" which is supposedly implemented in Insightful's
    MM> "Robust library" and consequently in the 'robust' R package.
    MM> The 'robust.pdf' manual (of Insightful's original) says this on
    MM> page 35: 

       > The Robust Library deals with this problem by using a new
       > alternate S/M-estimate computing algorithm due to Maronna and
       > Yohai (1999) for robustly fitting linear models which contain factor
       > variables with possibly many levels. S-PLUS automatically uses the
       > new S/M-estimate algorithm whenever your linear model data
       > contains at least one factor variable. For further information see the
       > Theoretical Details section Alternating S and M Initial Estimate.

    MM> *AND* in last year's "robust stats in R" meeting in Banff,
    MM> we had decided that this algorithm should really become an
    MM> option in 'robustbase' ((but it seems we hadn't made good
    MM> enough work assignments there ... ;-))

    MM> Anyway, I've tried

    MM> library(robust)
    MM> mLMR. <- lmRob(fo, data = long)

    MM> and unfortunately, that failed too, even though I'd have
    MM> expected it would work thanks to using the S/M algorithm 
    MM> but *ALAS* it gets into problems as well..

Ok, I've debugged that.
It's from a somewhat embarrassing bug in package 'robust':
the internally used function splus.assign() has a bug
which only triggers when there is no intercept --- as in your case.

---> Ajay, you *can* fit by putting an intercept,
using the 'robust' package and lmRob()

or by patching the bug and re-installing 'robust' :

In function splus.assign, instead of the wrong

  if(min(asgn) == 0)
    term.labels <- c("(Intercept)", term.labels)
  asgn <- asgn + 1

you must use

  if(min(asgn) == 0) {
    term.labels <- c("(Intercept)", term.labels)
    asgn <- asgn + 1
  }


---
Martin Maechler, ETH Zurich

    MM> I'm interested in more feedback, particularly from other experts 
    MM> about S/M and/or its implementation in 'robust'.


    MM> If you could guide me on what I'm doing wrong, that'll be great. How
    MM> would I do the above specification as a robust regression? I googled
    MM> around and I found a few others asking these same questions in the
    MM> past, but it didn't look like there was a clear answer.

    MM> In short: The  "MM"  method hasn't been well implemented for
    MM> this situation,
    MM> and you need to stick with the default

    MM> rlm( )  for now.

    MM> Martin Maechler, ETH Zurich

    MM> 
    MM> --
    MM> Ajay Shah                                      http://www.mayin.org/ajayshah
    MM> ajayshah using mayin.org                             http://ajayshahblog.blogspot.com

    MM> _______________________________________________
    MM> R-SIG-Robust using r-project.org mailing list
    MM> https://stat.ethz.ch/mailman/listinfo/r-sig-robust




More information about the R-SIG-Robust mailing list