[R-sig-ME] Problems using Anova functions 'type = 2' or 'type = 3' from car package with lme
g@@d|o @end|ng |rom po@t@bgu@@c@||
Mon Oct 28 15:11:28 CET 2019
for your clarification and the recommendation of this package. It would be
great if at any moment the statistician from your working place, or any
other expert in this forum, can tell us:
*1. Why Type II is better?* I personally read different reasons in favour
or against its use. Also, I read about using Type III, but since Im not an
expert, I decide to go for Type III since STATISTICA, SPSS and other
softwares use it.
*2. What's different from Type II and Type III?* In my trials, I see that
both do not depend on the order we 'enter' the data, but differences on the
F and P-value of the main effects when there is an interaction in the
model. In any place I read that Type III is better when we have a
significant interaction while Type II when not. In any case
3. due to marginality principle, neither with Type II or Type III we can
interpret the main effects when are involved in an interaction, right?
4. *Do this affects also interactions? *when a higher-order interaction in
present, lower order ones can be interpreted?
El lun., 28 oct. 2019 a las 12:23, Julian Gaviria Lopez (<
Julian.GaviriaLopez using unige.ch>) escribió:
> Hi Mario,
> Glad to hear you found the solution. Unfortunately I can not validate it,
> since I am not a stats expert. I was thinking that maybe the emmeans
> package could help you for the post-hoc contrasts, and the interaction
> P.D. The statistician from my dept. encourages us to work always
> with ANOVA type II. Maybe further information about it might be found not
> here, but in another list, such as stack overflow.
> Julian Gaviria
> Neurology and Imaging of cognition lab (Labnic)
> University of Geneva. Campus Biotech.
> 9 Chemin des Mines, 1202 Geneva, CH
> Tel: +41 22 379 0380
> Email: Julian.GaviriaLopez using unige.ch
> *From:* R-sig-mixed-models <r-sig-mixed-models-bounces using r-project.org> on
> behalf of Mario Garrido <gaadio using post.bgu.ac.il>
> *Sent:* Monday, October 28, 2019 11:18:44 AM
> *To:* r-sig-mixed-models using r-project.org
> *Subject:* Re: [R-sig-ME] Problems using Anova functions 'type = 2' or
> 'type = 3' from car package with lme
> I think I have found the solution using:
> anova.lme(model,type = "sequential") # same results as anova(model); it
> seems logical, since Type I is sequential
> anova.lme(model,type = "marginal") # as far as I know, sorry of Im wrong,
> Type III is also called marginal
> El lun., 28 oct. 2019 a las 10:33, Mario Garrido (<gaadio using post.bgu.ac.il>)
> > Hello,
> > I use lme to create a linear mixed effects model with three fixed factors
> > (Treatment, species and Period) and one random factor (individual
> > ExpID).
> > After creating the model, I tried to apply Anova from car package to
> > compute results with both Type II and III Sum of Squares, but I get the
> > error stated below:
> > I have UNBALANCED data, more data from sp1 than for the others
> > These are the data types.
> > > str(Data)
> > 'data.frame': 496 obs. of 27 variables:
> > $ Trtmnt2 : Factor w/ 2 levels "Control","Treated": 2 2 2 2 2 2 2 2
> > 1 ...
> > $ ExpID : Factor w/ 62 levels "EA1","EA10","EA11",..: 1 1 1 1 1 1
> > 1 10 10 ...
> > $ sp : Factor w/ 3 levels "sp1","sp2","sp3": 2 2 2 2 2 2 2 2 2
> > ...
> > $ Period : Factor w/ 5 levels "Before","earlypeak",..: 1 5 2 4 3 5
> > 3 1 2 ...
> > $ StdzDiff : num -51.1 -53.2 -49 22.9 ...
> > Here is the code to generate the model
> > > library(car)
> > > options(contrasts = c("contr.sum", "contr.poly"))
> > > model<- lme(StdzDiff ~ Trtmnt2*sp*Period, data = Data, random = ~
> > 1|factor(ExpID))
> > > Anova(model, type=2) #with type = 3, I have the same problems
> > Error in I.p[subs.relatives, , drop = FALSE] :
> > subscript out of bounds
> > I have no problems with 'default' anova. But, I get the same error
> > working with the following code
> > model<- lme(StdzDiff ~ Trtmnt2*sp*Period, data =
> > DataFreqDark_StdzDiff_peakAll, random = ~
> > 1|factor(ExpID),contrasts=list(Trtmnt2=contr.sum, sp=contr.sum,
> > Period=contr.sum))
> > My questions:
> > 1) What is my error?
> > 2) If Anova from car cannot deal with lme, how can I apply Type III to my
> > model?
> > 3) To confirm, if I define nothing, anova with lme, is type I by default?
> > Thanks!
> Mario Garrido Escudero, PhD
> Dr. Hadas Hawlena Lab
> Mitrani Department of Desert Ecology
> Jacob Blaustein Institutes for Desert Research
> Ben-Gurion University of the Negev
> Midreshet Ben-Gurion 84990 ISRAEL
> gaiarrido using gmail.com; gaadio using post.bgu.ac.il
> phone: (+972) 08-659-6854
> [[alternative HTML version deleted]]
> R-sig-mixed-models using r-project.org mailing list
Mario Garrido Escudero, PhD
Dr. Hadas Hawlena Lab
Mitrani Department of Desert Ecology
Jacob Blaustein Institutes for Desert Research
Ben-Gurion University of the Negev
Midreshet Ben-Gurion 84990 ISRAEL
gaiarrido using gmail.com; gaadio using post.bgu.ac.il
phone: (+972) 08-659-6854
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models