<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
Dear all,<br>
Today, I send two mails related to robust ANOVA in R, but since the
scope and target are different, it is better to separate the subjects.
In the next mail, there is a praise to improve the accessibility of
robust methods for ANOVA. As far as I can understand, roust ANOVA
cannot be run with lmrob from the robustbase library, see the other
mail. In this mail, I list several bugs in lmRob from the robust
library. <br>
<br>
<ul>
  <li>There is a bug in the function "lmRob": when formulas with
interaction between factors are given, only the main effects are
considered as factors, but the interaction is considered as a
continuous variable. This is problematic, since the initial estimator
is very likely give an error because of the discrete type of the
interaction. Example:</li>
</ul>
<blockquote><tt>> summary(lmRob (formula = Resp~Origine*Sexe, data =
POVm3))<br>
  </tt></blockquote>
<blockquote><tt>Error in psi.weight(wi[wcnd], ipsi, xk) : <br>
  NA/NaN/Inf in foreign function call (arg 2)<br>
In addition: Warning message:<br>
In lmRob.fit.compute(x2, y, x1 = x1, x1.idx = x1.idx, nrep = nrep,  :<br>
  Initial scale less than tl =  1e-06 .</tt><br>
  <br>
Attached is a fix to the function lmRob, see the two lines with "###
added". I'm not a guru programmer so you might have to check the code.
With this corrected function, the above call works.<br>
</blockquote>
<br>
<ul>
  <li>It is not a bug, but there are more initial algorithms than
initial.alg in lmRob.control let the user choose. More importantly,
depending on the type of covariates, the user's choice can be silently
overridden (in the function lmRob.fit.compute). I do not criticize
this, but I suggest that (a) a message is displayed to inform the user
of this modification and (b) that the initial algorithm that is finally
used be written the lmRob object. For the moment, the user has no way
to know which initial algorithm is used.</li>
</ul>
<br>
<ul>
  <li>There is a bug in the function "anova.lmRob": in the presence of
missing values in the covariates, the models that are compared do not
contain the same number of observations, which drives the inference
completely wrong. Again, I am not a specialist, but I think it comes
from the line</li>
</ul>
<blockquote>               curobj <- update(object, curfrm)    <br>
which uses the original data frame instead of using only the
observations with no missing in the FULL model (which are given in the
lm object obj$model). When smaller models are compared, typically some
observations that were not used in the full model are used. I'm not
sure how to fix this bug.<br>
</blockquote>
<br>
<ul>
  <li>Maybe related to this missing value problem, I have found an F
value equal to -133, although the corresponding t-value in summary was
close to zero, but not suspect.</li>
</ul>
<blockquote><tt>>
anova(lmRob(ttf~income*sexe,data=cig,na.action=na.omit))<br>
  <br>
Terms added sequentially (first to last)<br>
  <br>
            Chisq Df  RobustF     Pr(F)    <br>
(Intercept)        1                       <br>
income             1   69.576 < 2.2e-16 ***<br>
sexe               1   14.989  7.97e-05 ***<br>
income:sexe        1 -133.293         1    <br>
---<br>
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 <br>
Warning messages:<br>
1: In chi.weight(res/Scale, ipsi, yc) - chi.weight(Res/Scale, ipsi,  :<br>
  longer object length is not a multiple of shorter object length<br>
2: In chi.weight(res/Scale, ipsi, yc) - chi.weight(Res/Scale, ipsi,  :<br>
  longer object length is not a multiple of shorter object length<br>
  </tt></blockquote>
<br>
<ul>
  <li>Some prominent members of the S/R community will not consider
this as a bug, but in a companion mail, I give arguments to include
so-called "Type III sums of squares" or effect tested marginally. In
the context of unbalanced ANOVA, there are other prominent members of
the statistics community that give extremely convincing arguments, see
other mail. I know it can be done by hand, but for an average user,
having it as an optional argument to anova.lmRob would be an important
argument to use R and robust ANOVA.</li>
</ul>
<big> </big>Cheers,<br>
Olivier<br>
<br>
<pre class="moz-signature" cols="72">-- 
!!! New e-mail, please update your address book !!!
<a class="moz-txt-link-abbreviated" href="mailto:Olivier.Renaud@unige.ch">Olivier.Renaud@unige.ch</a>               <a class="moz-txt-link-freetext" href="http://www.unige.ch/fapse/mad/">http://www.unige.ch/fapse/mad/</a>
Methodology & Data Analysis - Psychology Dept - University of Geneva
UniMail, Office 4164  -  40, Bd du Pont d'Arve   -  CH-1211 Geneva 4
</pre>
</body>
</html>