[R] lme anova() and model simplification
Kingsford Jones
kingsfordjones at gmail.com
Tue Mar 10 00:41:09 CET 2009
Read section 2.4.2 of Pinheiro and Bates again. It describes the
differences between the 4 methods of inference you tried (marginal
t-test, sequential F-tests, LRTs and CIs) and makes some
recommendations. There are some tricky issues involved in drawing
inferences from mixed models, and unfortunately the issues are
compounded by the sparseness of your data in the predictor space.
hth,
Kingsford Jones
On Mon, Mar 9, 2009 at 4:44 PM, Menelaos Stavrinides <menstav at gmail.com> wrote:
> I am running an lme model with the main effects of four fixed variables (3
> continuous and one categorical – see below) and one random variable. The
> data describe the densities of a mite species – awsm – in relation to four
> variables: adh31 (temperature related), apsm (another plant feeding mite)
> awpm (a predatory mite), and orien (sampling location within plant – north
> or south).
>
>
>
> I have read in Pinheiro and Bates that anova(model) can be used to asses the
> significance of fixed factors. In my case, anova(model) gives different
> results than summary(model) and I am not sure which p values I should use as
> a guide for model simplification.
>
>
>
> I have tried using either as a guide, but I get to a point where
> summary(model) or anova(model) suggest that a factor is not significant (p
> value>0.05) but when I remove it and compare the model with and without the
> F value is significant – the same is true for all three factors that appear
> as non significant in my final model. It makes me a bit suspicious that the
> F-value for the deletion test is always 0.0099 independently of the factor
> that I remove. Any suggestions greatly appreciated.
>
>
>
> The actual data follow at the end of the R code.
>
>
>
> Thanks,
>
> Mel
>
>
>
>
>
>> library(nlme)
>
>> model<-lme(awsm~adh31+awpm+apsm+orien,random=~1|viney)
>
>> summary(model)
>
> Linear mixed-effects model fit by REML
>
> Data: NULL
>
> AIC BIC logLik
>
> 49.84102 51.22159 -17.92051
>
>
>
> Random effects:
>
> Formula: ~1 | viney
>
> (Intercept) Residual
>
> StdDev: 1.59297 0.2689783
>
>
>
> Fixed effects: awsm ~ adh31 + awpm + apsm + orien
>
> Value Std.Error DF t-value p-value
>
> (Intercept) 0.7192961 0.8020099 7 0.8968669 0.3996
>
> adh31 0.3105583 0.3175280 2 0.9780504 0.4312
>
> awpm 0.4373813 0.2282457 2 1.9162743 0.1954
>
> apsm 0.1487537 0.2099112 2 0.7086502 0.5520
>
> oriensouth -0.5599473 0.2254709 2 -2.4834566 0.1310
>
> Correlation:
>
> (Intr) adh31 awpm apsm
>
> adh31 -0.636
>
> awpm -0.440 0.451
>
> apsm 0.317 -0.756 -0.310
>
> oriensouth 0.433 -0.608 -0.274 0.201
>
>
>
> Standardized Within-Group Residuals:
>
> Min Q1 Med Q3 Max
>
> -0.81103399 -0.31639155 -0.03371192 0.29211809 0.80633666
>
>
>
> Number of Observations: 14
>
> Number of Groups: 8
>
>> intervals(model)
>
> Approximate 95% confidence intervals
>
>
>
> Fixed effects:
>
> lower est. upper
>
> (Intercept) -1.1771559 0.7192961 2.6157481
>
> adh31 -1.0556542 0.3105583 1.6767709
>
> awpm -0.5446806 0.4373813 1.4194432
>
> apsm -0.7544215 0.1487537 1.0519289
>
> oriensouth -1.5300704 -0.5599473 0.4101758
>
> attr(,"label")
>
> [1] "Fixed effects:"
>
>
>
> Random Effects:
>
> Level: viney
>
> lower est. upper
>
> sd((Intercept)) 0.9312527 1.59297 2.724882
>
>
>
> Within-group standard error:
>
> lower est. upper
>
> 0.1096949 0.2689783 0.6595509
>
>> anova(model)
>
> numDF denDF F-value p-value
>
> (Intercept) 1 7 9.702400 0.0170
>
> adh31 1 2 0.015683 0.9118
>
> awpm 1 2 2.824076 0.2349
>
> apsm 1 2 1.520431 0.3428
>
> orien 1 2 6.167557 0.1310
>
>>
>
>>
>
>> model2<-lme(awsm~adh31+awpm+apsm+orien,random=~1|viney,method="ML")
>
>> model3<-lme(awsm~adh31+awpm+orien,random=~1|viney,method="ML")
>
>> anova(model2,model3)
>
> Model df AIC BIC logLik Test L.Ratio p-value
>
> model2 1 7 42.44324 46.91664 -14.22162
>
> model3 2 6 41.47847 45.31281 -14.73924 1 vs 2 1.035230 0.3089
>
>>
>
>> model3.1<-lme(awsm~adh31+awpm+orien,random=~1|viney)
>
>> summary(model3.1)
>
> Linear mixed-effects model fit by REML
>
> Data: NULL
>
> AIC BIC logLik
>
> 47.01767 48.83318 -17.50883
>
>
>
> Random effects:
>
> Formula: ~1 | viney
>
> (Intercept) Residual
>
> StdDev: 1.592549 0.2471161
>
>
>
> Fixed effects: awsm ~ adh31 + awpm + orien
>
> Value Std.Error DF t-value p-value
>
> (Intercept) 0.5357316 0.7333251 7 0.7305512 0.4888
>
> adh31 0.4829425 0.1911191 3 2.5269194 0.0857
>
> awpm 0.4850814 0.1996481 3 2.4296822 0.0934
>
> oriensouth -0.5961750 0.2031294 3 -2.9349512 0.0608
>
> Correlation:
>
> (Intr) adh31 awpm
>
> adh31 -0.609
>
> awpm -0.360 0.345
>
> oriensouth 0.379 -0.712 -0.225
>
>
>
> Standardized Within-Group Residuals:
>
> Min Q1 Med Q3 Max
>
> -1.10623050 -0.20081291 -0.09441451 0.19507694 1.08369449
>
>
>
> Number of Observations: 14
>
> Number of Groups: 8
>
>>
>
>> model4<-lme(awsm~adh31+orien,random=~1|viney,method="ML")
>
>> anova(model3,model4)
>
> Model df AIC BIC logLik Test L.Ratio p-value
>
> model3 1 6 41.47847 45.31281 -14.73924
>
> model4 2 5 46.13353 49.32881 -18.06676 1 vs 2 6.655056 0.0099
>
>>
>
>>
>
>> model5<-lme(awsm~awpm+orien,random=~1|viney,method="ML")
>
>> anova(model3,model5)
>
> Model df AIC BIC logLik Test L.Ratio p-value
>
> model3 1 6 41.47847 45.31281 -14.73924
>
> model5 2 5 46.13124 49.32653 -18.06562 1 vs 2 6.652772 0.0099
>
>>
>
>> model6<-lme(awsm~awpm+orien,random=~1|viney,method="ML")
>
>> anova(model3,model6)
>
> Model df AIC BIC logLik Test L.Ratio p-value
>
> model3 1 6 41.47847 45.31281 -14.73924
>
> model6 2 5 46.13124 49.32653 -18.06562 1 vs 2 6.652772 0.0099
>
>>
>
>
>
>
>
> # actual data used for analyses
>
>
>
>
>
>
>
>> awsm<-log(wsmmax/days+1)
>
>> apsm<-log(psm/days+1)
>
>> awpm<-log(wpm/days+1)
>
>> adh31<-log(dh31/days+1)
>
>>
>
>> awsm
>
> [1] 0.52224518 3.29454964 0.01695951 1.36088200 2.01692487 4.57307785
>
> [7] 0.41499043 2.66783465 1.02173903 2.66030752 0.83589370 1.22387225
>
> [13] 4.93707366 2.25271004
>
>> apsm
>
> [1] 1.9938465 1.8572201 0.2595992 1.3926976 0.0000000 0.5222452 2.1845666
>
> [8] 3.0942586 3.8885649 2.6691373 0.0000000 0.0000000 1.9460277 4.2546503
>
>> awpm
>
> [1] 0.9333715 1.9485709 0.0000000 0.1381489 1.5627542 0.0000000 0.4149904
>
> [8] 0.0000000 0.7482365 0.5215986 0.5113811 1.4076002 1.0598621 0.1732711
>
>> adh31
>
> [1] 0.8329868 1.4813520 2.5733515 2.8888284 1.4217520 2.1184476 2.5843313
>
> [8] 2.9896871 3.0351911 2.4386017 2.4736569 2.2904899 2.7930367 3.3185963
>
>> orien
>
> [1] int int int int int int int int south south south south
>
> [13] south south
>
> Levels: int south
>
>> viney
>
> [1] lpsm06 lwsm06 mpsm06 mwsm06 lpsm07 lwsm07 mpsm07 mwsm07 lpsm06 lwsm06
>
> [11] mwsm06 lpsm07 lwsm07 mwsm07
>
> Levels: lpsm06 lpsm07 lwsm06 lwsm07 mpsm06 mpsm07 mwsm06 mwsm07
>
>
>
>
> --
> Menelaos Stavrinides
> Ph.D. Candidate
> Environmental Science, Policy and Management
> 137 Mulford Hall MC #3114
> University of California
> Berkeley, CA 94720-3114 USA
> Tel: 510 717 5249
>
> [[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