[R] R: Re: Problem with anova.lmRob() "robust" package
m.fenati at libero.it
m.fenati at libero.it
Thu Jul 28 18:43:20 CEST 2011
I'm sorry, maybe the question was bad posed.
Ista has well described my problem.
Thanks
Massimo
>----Messaggio originale----
>Da: izahn a psych.rochester.edu
>Data: 28/07/2011 17.52
>A: "David Winsemius"<dwinsemius a comcast.net>
>Cc: "m.fenati a libero.it"<m.fenati a libero.it>, <r-help a r-project.org>
>Ogg: Re: [R] Problem with anova.lmRob() "robust" package
>
>I found the question really confusing as well, but see below.
>
>On Thu, Jul 28, 2011 at 11:42 AM, David Winsemius
><dwinsemius a comcast.net> wrote:
>>
>> On Jul 28, 2011, at 9:13 AM, m.fenati a libero.it wrote:
>>
>>>
>>> Dear R users,
>>> I'd like to known your opinion about a problem with anova.lmRob() of
>>> "Robust" package that occurs when I run a lmRob() regression on my
dataset.
>>> I check my univariate model by single object anova as anova(lmRob(y~x)).
>>> If I compare my model with the null model (y~1), I must obtain the same
>>> results,
>>> but not for my data.
>>> Is it possible?
>>>
>>> My example:
>>>
>>> x<-c(rep(0,8),rep(1,8),rep(2,7))
>>>
>>> y<-c(1,0.6,-0.8,0.7,1.6,-0.2,-1.2,-3.8,-1.8,-2.6,-1.7,-2.1,-0.3,-1.4,1.4,
-0.3,-0.3,0.5,0.4,-0.9,-1.6,0.4,0.4)
>>> library(robust)
>>> lmR<-lmRob(y~factor(x))
>>> anova(lmR)
>>> lmR0<-lmRob(y~1)
>>> anova(lmR,lmR0)
>>>
>>> If I run the code omitting the factor() (then treating "x" as continuous),
>>> the results are the same..
>>>
>>
>> I do not get the same results with that code. And the code does not appear
>> to track your description, since the second model does not have an "x" term
>> in it. Even when I create the model that it sounded as though you would
have
>> written, namely lmR0 <- lmRob(y ~ x), it is clearly _not_ the same result.
>>
>>> coef(lmR)
>> (Intercept) factor(x)1 factor(x)2
>> 0.2428571 -1.3432007 -0.4000000
>>> coef(lmR0)
>> (Intercept) x
>> -0.509524217 0.005820355
>>>
>>> What is the explanation of these different results?
>>
>> Since you didn't post your results and since your complaint was that they
>> are "the same", it's hard to know what you are talking about.
>
>I think the question is why
>
>lm1 <- lm(y ~ factor(x))
>lm0 <- lm(y ~ 1)
>anova(lm1)
>anova(lm0, lm1)
>
>gives the same result, but
>
>lmR<-lmRob(y~factor(x))
>lmR0<-lmRob(y~1)
>anova(lmR)
>anova(lmR,lmR0)
>
>does not.
>
>I don't know the answer, but I think it is an interesting question.
>
>Best,
>Ista
>
>>
>> --
>> David Winsemius, MD
>> West Hartford, CT
>>
>> ______________________________________________
>> R-help a r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.
html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
>--
>Ista Zahn
>Graduate student
>University of Rochester
>Department of Clinical and Social Psychology
>http://yourpsyche.org
>
More information about the R-help
mailing list