[R] lme problems

Mark Difford mark_difford at yahoo.co.uk
Tue Sep 23 11:11:41 CEST 2008


Hi Tommaso,

>> I struggle to understand the discrepancy in df between the anova and lme,
>> and the 
>> fact that the interaction term is not significant in the anova but
>> significant in lme.

To begin with, why try to compare things that are obviously quite different?
Surely you can see that the error structure of the two models are different?

aov(Mean1~treatment*layingday+Error(male.pair/treatment/layingday))
lme(Mean1 ~ treatment*layingday, random = ~1|male.pair)

If you want to compare them then at least make them "equal," otherwise what
is the point? (And one might ask, What is the point, anyway?)

## This would be a reasonable comparison
aov(Mean1~treatment*layingday+Error(male.pair))
lme(Mean1 ~ treatment*layingday, random = ~1|male.pair)

Regards, Mark.


Tommaso Pizzari wrote:
> 
> Hi, 
> I'm analysing a dataset in which the same 5 subjects (male.pair) were
> subjected to two treatments (treatment) and were measured for 12
> successive days within each treatment (layingday). Overall 5*2*12=120
> observations. 
> 
> I want to test the effect of treatment, time (layingday) and their
> interaction. I have done so through the ANOVA below:
> 
>> bmc3<-aov(Mean1~treatment*layingday+Error(male.pair/treatment/layingday))
>> summary(bmc3)
> 
> Error: male.pair
>           Df  Sum Sq Mean Sq F value Pr(>F)
> Residuals  1 0.13850 0.13850               
> 
> Error: male.pair:treatment
>           Df  Sum Sq Mean Sq
> treatment  1 0.60525 0.60525
> 
> Error: male.pair:treatment:layingday
>           Df  Sum Sq Mean Sq
> layingday  1 0.64037 0.64037
> 
> Error: Within
>                      Df  Sum Sq Mean Sq F value    Pr(>F)    
> treatment             1 0.02015 0.02015  0.7340    0.3934    
> layingday             1 0.52937 0.52937 19.2878 2.545e-05 ***
> treatment:layingday   1 0.02959 0.02959  1.0782    0.3013    
> Residuals           113 3.10135 0.02745                      
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
> 
> I then wanted to compare this outcome with an lme, and used the model
> below. However, its outcome doesn't make much sense to me. 
> 
>> bmc4<- lme(Mean1 ~ treatment*layingday, random = ~1|male.pair)
>> summary(bmc4)
> Linear mixed-effects model fit by REML
>  Data: NULL 
>         AIC       BIC   logLik
>   -118.4522 -101.9306 65.22609
> 
> Random effects:
>  Formula: ~1 | male.pair
>         (Intercept)  Residual
> StdDev:   0.1313573 0.1185902
> 
> Fixed effects: Mean1 ~ treatment * layingday 
>                          Value  Std.Error  DF   t-value p-value
> (Intercept)          0.5311005 0.09369140 112  5.668615  0.0000
> treatment            0.0495373 0.04616116 112  1.073138  0.2855
> layingday           -0.0488055 0.00991701 112 -4.921389  0.0000
> treatment:layingday  0.0138449 0.00627207 112  2.207388  0.0293
>  Correlation: 
>                     (Intr) trtmnt lyngdy
> treatment           -0.739              
> layingday           -0.688  0.838       
> treatment:layingday  0.653 -0.883 -0.949
> 
> Standardized Within-Group Residuals:
>         Min          Q1         Med          Q3         Max 
> -2.44529424 -0.68505388  0.01663401  0.59009515  3.53354000 
> 
> Number of Observations: 120
> Number of Groups: 5 
> 
> I struggle to understand the discrepancy in df between the anova and lme,
> and the fact that the interaction term is not significant in the anova but
> significant in lme. Any help would be greatly appreciated. 
> Best
> Tom
> 
> -- 
> Dr. Tommaso Pizzari
> Edward Grey Institute, Dept of Zoology, 
> University of Oxford, Oxford OX1 3PS
> Tel: (44) 1865 271279, Fax: (44) 1865 271168
> 
> 
> ______________________________________________
> 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.
> 
> 

-- 
View this message in context: http://www.nabble.com/lme-problems-tp19616517p19623990.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list