# [R] robust regression

Joerg Schaber Joerg.Schaber at uv.es
Sun Aug 10 17:56:41 CEST 2003

```Hi,

the package is called "quantreg" and yes, it solved my problem. LAD
regression was actually the method I was looking for, thanks a lot.
However, some of my problems are rather large and even if I use the
method 'fn' and 'pfn' recommended for large problems in 'rq' I get an
error:

> res <- rq(o ~ y + s
-1,tau=0.5,method="fn",contrasts=list(s=("contr.sum")))
Error: cannot allocate vector of size 1950212 Kb

Is there are way to avoid that? The least square procedures are able to
handle these large problems.

best wishes,

joerg

Patrick Burns wrote:

> Two possible alternatives are:
>
> 1) Use least absolute deviation regression, which you can
> get from Roger Koenker's package that I think is called
> "quantile".
>
> 2) The LAD regression is essentially equivalent to median
> polish (see, for instance, "Understanding Robust and Exploratory
> Data Analysis" by Hoaglin, Mosteller and Tukey).  To gain some
> more efficiency for nearly Gaussian data, you could replace the
> median by a location estimator that is more efficient, such as a
> trimmed mean.
>
> Good luck,
>
> Patrick Burns
>
> Burns Statistics
> patrick at burns-stat.com
> +44 (0)20 8525 0696
> http://www.burns-stat.com
> (home of S Poetry and "A Guide for the Unwilling S User")
>
> Joerg Schaber wrote:
>
>> Hi,
>>
>> trying to do a robust regression of a two-way linear model, I keep
>> getting the following error:
>>
>> > lqs(obs ~ y + s -1,method="lms", contrasts=list(s=("contr.sum")))
>> Error: lqs failed: all the samples were singular
>>
>> Robust regression with M-estimators works (also regular least square
>> fits, of course):
>> rlm.formula(formula = obs ~ y + s - 1, method = "M", contrasts =
>> list(s = ("contr.sum")))
>>
>> I tried an exact sampling (psamp="exact"), but I keep getting syntax
>> errors. Any idea how I can make the first one work?
>>
>> Thanks,
>>
>> joerg
>>
>
>
>

--
----------------------------------------------------------
Jörg Schaber
Instituto Cavanilles de Biodiversidad y Biologia Evolutiva
Universidad de Valencia               Tel.: ++34 96 354 3666
A.C. 22085                            Fax.: ++34 96 354 3670
46071 Valencia, España                email : jos at uv.es

```