[R] Anova interaction not tested
Bert Gunter
gunter.berton at gene.com
Thu Apr 9 16:41:07 CEST 2009
Gabe:
Don't be silly. lme is not appropriate here --you have only one stratum!.
Use lm and you'll see what's going on. It also looks like you should do some
reading up on linear models. V&R's MASS or Peter Dalgaard's INTRO to
Statistics with R might be places to start.
Incidentallyy, Version 2.8.1 of R gives for the output of aov:
########
aov(speed~brand*material)
Call:
aov(formula = speed ~ brand * material)
Terms:
brand material Residuals
Sum of Squares 49.86190 13.50167 21.00500
Deg. of Freedom 2 2 2
Residual standard error: 3.240756
4 out of 9 effects not estimable
Estimated effects may be unbalanced
Warning messages:
1: In model.matrix.default(mt, mf, contrasts) :
variable 'brand' converted to a factor
2: In model.matrix.default(mt, mf, contrasts) :
variable 'material' converted to a factor
########
Seems like this should pretty much tell you what's going on -- if you
understand linear models. (and if you don't, why not, since you're using
them?)
Cheers,
Bert
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Gabriel Murray
Sent: Wednesday, April 08, 2009 4:08 PM
To: Patrick Connolly
Cc: r-help at r-project.org
Subject: Re: [R] Anova interaction not tested
Playing around with this some more, it looks like it may purely be due to
the way that R handles unbalanced data. I will investigate lme for this.
Best,
Gabe
On Wed, Apr 8, 2009 at 3:24 PM, Gabriel Murray <p.editor at gmail.com> wrote:
> Here is some toy data to give an example. Imagine someone is test-riding
> several bicycles to decide which to buy, and measures their average speed
> during each test-ride. They want to assess the main effects and
interaction
> of brand and material on speed.
>
> Speed Size Brand Material
> 20 small giant steel
> 25.1 medium giant steel
> 25.2 medium trek aluminum
> 26 small cannondale carbon
> 19.9 large giant aluminum
> 21 medium trek carbon
> 30 medium cannondale carbon
>
> This is the output I get:
>
> > fit = aov(Speed~Brand*Material, data=myData)
> > summary(fit)
> Df Sum Sq Mean Sq F value Pr(>F)
> Brand 2 49.862 24.931 2.3738 0.2964
> Material 2 13.502 6.751 0.6428 0.6087
> Residuals 2 21.005 10.503
>
>
> I suppose I am missing something very obvious here as to why the
> interaction is not reported, but I don't see what it is.
> Cheers,
>
> Gabe
>
>
>
> On Wed, Apr 8, 2009 at 1:34 PM, Patrick Connolly <
> p_connolly at slingshot.co.nz> wrote:
>
>> On Wed, 08-Apr-2009 at 12:59PM -0700, Gabriel Murray wrote:
>>
>> |> I've noticed with certain datasets that when I try to do an anova and
>> test
>> |> for main effects and interaction for two explanatory variables,
>> sometimes
>> |> the main effect results are given but not the interaction results. For
>> |> example,
>> |>
>> |> ex1 = aov(Score ~ var1*var2, data=myData)
>> |> summary(ex1)
>>
>> Could it be that there are no degrees of freedom left?
>>
>> That's about my best guess without enough information.
>>
>>
>> |> ______________________________________________
>> |> R-help at 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.
>>
>>
>> Nothing you sent is reproducible.
>>
>>
>> --
>> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
>> ___ Patrick Connolly
>> {~._.~} Great minds discuss ideas
>> _( Y )_ Average minds discuss events
>> (:_~*~_:) Small minds discuss people
>> (_)-(_) ..... Eleanor Roosevelt
>>
>> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
>>
>
>
[[alternative HTML version deleted]]
______________________________________________
R-help at 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.
More information about the R-help
mailing list