1. This has nothing to do with R. It's your lack of understanding of linear models issues. See ?contrasts and ?contrast for the specific, but I doubt that you will understand how these fit in with the underlying statistical issues (and I would be delighted to be wrong). So, in order of (my )preference, you should try:
a) Consult a local statistician; b) Post on r-sig-mixed-models c) Post on a statistical advice list like stats.stackexchange.com . Cheers, Bert On Sat, Jun 30, 2012 at 9:44 AM, Andy Robertson <ar...@exeter.ac.uk> wrote: > Dear R users, > > > > I am using lmer combined with AIC model selection and averaging (in the > MuMIn package) to try and assess how isotope values (which indicate diet) > vary within a population of animals. > > > > I have multiple measures from individuals (variable 'Tattoo') and multiple > individuals within social groups within 4 locations (A, B, C ,D) crucially > I > am interested if there are differences between sexes and age classes > (variable AGECAT2) and whether this differs with location. > > However, whether or not I get a significant sex:location interaction > depends > on which location is my reference level and I cannot understand why this is > the case. It seems to be due to the fact that the standard error associated > with my interactions varies depending on which level is the reference. > > > > Any help or advice would be appreciated, > > > > Andrew Robertson > > > > Below is the example code of what I am doing and an example of the model > summary and model averaging results with location A as the ref level or > location B. > > > > if A is the reference level... > > > > #full model > > > Amodel<-lmer(d15N~(AGECAT2+Sex+Location1+AGECAT2:Location1+Sex:Location1+AGE > CAT2:Sex+(1|Year)+(1|Location1/Socialgroup/Tattoo)), REML=FALSE, > data=nocubs) > > > > #standardise model > > Amodels<-standardize(Amodel, standardize.y=FALSE) > > > > #dredge models > > summary(model.avg(get.models(Adredge,cumsum(weight)<0.95))) > > > > Then the average model coefficients indicate no sex by location interaction > > > Component models: > df logLik AICc Delta Weight > 235 13 -765.33 1557.28 0.00 0.68 > 1235 15 -764.55 1559.91 2.63 0.18 > 3 9 -771.64 1561.57 4.29 0.08 > 12345 17 -763.67 1562.37 5.09 0.05 > > Term codes: > AGECAT2 c.Sex Location1 AGECAT2:c.Sex > c.Sex:Location1 > 1 2 3 4 > 5 > > Model-averaged coefficients: > Estimate Std. Error z value Pr(>|z|) > (Intercept) 8.673592 0.474524 18.279 <2e-16 *** > c.Sex 0.095375 0.452065 0.211 0.833 > Location1B -3.972882 0.556575 7.138 <2e-16 *** > Location1C -3.633331 0.531858 6.831 <2e-16 *** > Location1D -3.348665 0.539143 6.211 <2e-16 *** > c.Sex:Location1B -0.372653 0.513492 0.726 0.468 > c.Sex:Location1C 0.428299 0.511254 0.838 0.402 > c.Sex:Location1D -0.757582 0.512586 1.478 0.139 > AGECAT2OLD -0.179772 0.150842 1.192 0.233 > AGECAT2YEARLING -0.009596 0.132328 0.073 0.942 > AGECAT2OLD:c.Sex 0.045963 0.296471 0.155 0.877 > AGECAT2YEARLING:c.Sex -0.323985 0.268919 1.205 0.228 > --- > > > And the full model summary looks like this.. > > > > > > Linear mixed model fit by maximum likelihood > > Formula: d15N ~ (AGECAT2 + Sex + Location1 + AGECAT2:Location1 + > Sex:Location1 + AGECAT2:Sex + (1 | Year) + (1 | > Location1/Socialgroup/Tattoo)) > > Data: nocubs > > AIC BIC logLik deviance REMLdev > > 1568 1670 -761.1 1522 1534 > > Random effects: > > Groups Name Variance Std.Dev. > > Tattoo:(Socialgroup:Location1) (Intercept) 0.35500 0.59582 > > Socialgroup:Location1 (Intercept) 0.35620 0.59682 > > Location1 (Intercept) 0.00000 0.00000 > > Year (Intercept) 0.00000 0.00000 > > Residual 0.49584 0.70416 > > Number of obs: 608, groups: Tattoo:(Socialgroup:Location1), 132; > Socialgroup:Location1, 22; Location1, 4; Year, 2 > > > > Fixed effects: > > Estimate Std. Error t value > > (Intercept) 8.83179 0.52961 16.676 > > AGECAT2OLD -0.44101 0.41081 -1.074 > > AGECAT2YEARLING 0.01805 0.38698 0.047 > > SexMale -0.11346 0.51239 -0.221 > > Location1B -3.97880 0.63063 -6.309 > > Location1C -4.04816 0.60404 -6.702 > > Location1D -3.36389 0.63304 -5.314 > > AGECAT2OLD:Location1B 0.44198 0.54751 0.807 > > AGECAT2YEARLING:Location1B -0.22134 0.52784 -0.419 > > AGECAT2OLD:Location1C 0.20684 0.50157 0.412 > > AGECAT2YEARLING:Location1C 0.24132 0.47770 0.505 > > AGECAT2OLD:Location1D 0.53653 0.52778 1.017 > > AGECAT2YEARLING:Location1D 0.51755 0.51038 1.014 > > SexMale:Location1B -0.02442 0.57546 -0.042 > > SexMale:Location1C 0.74680 0.58128 1.285 > > SexMale:Location1D -0.41800 0.59505 -0.702 > > AGECAT2OLD:SexMale -0.08907 0.32513 -0.274 > > AGECAT2YEARLING:SexMale -0.40146 0.30409 -1.320 > > > > > > If location B is the reference level then the average model coefficients > indicate an age by sex interaction in location C. > > > > Component models: > df logLik AICc Delta Weight > 235 13 -765.33 1557.28 0.00 0.68 > 1235 15 -764.55 1559.91 2.63 0.18 > 3 9 -771.64 1561.57 4.29 0.08 > 12345 17 -763.67 1562.37 5.09 0.05 > > Term codes: > AGECAT2 c.Sex Location2 AGECAT2:c.Sex > c.Sex:Location2 > 1 2 3 4 > 5 > > Model-averaged coefficients: > Estimate Std. Error z value Pr(>|z|) > (Intercept) 4.700710 0.294275 15.974 <2e-16 *** > c.Sex -0.277278 0.248093 1.118 0.2637 > Location2A 3.972882 0.556575 7.138 <2e-16 *** > Location2C 0.339551 0.379873 0.894 0.3714 > Location2D 0.624217 0.390063 1.600 0.1095 > c.Sex:Location2A 0.372653 0.513492 0.726 0.4680 > c.Sex:Location2C 0.800952 0.345898 2.316 0.0206 * > c.Sex:Location2D -0.384929 0.346832 1.110 0.2671 > AGECAT2OLD -0.179772 0.150842 1.192 0.2333 > AGECAT2YEARLING -0.009596 0.132328 0.073 0.9422 > AGECAT2OLD:c.Sex 0.045963 0.296471 0.155 0.8768 > AGECAT2YEARLING:c.Sex -0.323985 0.268919 1.205 0.2283 > > And the full model summary looks like this.. > > --- > > Linear mixed model fit by maximum likelihood > > Formula: d15N ~ (AGECAT2 + Sex + Location2 + AGECAT2:Location2 + > Sex:Location2 + AGECAT2:Sex + (1 | Year) + (1 | > Location2/Socialgroup/Tattoo)) > > Data: nocubs > > AIC BIC logLik deviance REMLdev > > 1568 1670 -761.1 1522 1534 > > Random effects: > > Groups Name Variance Std.Dev. > > Tattoo:(Socialgroup:Location2) (Intercept) 0.35500 0.59582 > > Socialgroup:Location2 (Intercept) 0.35618 0.59681 > > Location2 (Intercept) 0.00000 0.00000 > > Year (Intercept) 0.00000 0.00000 > > Residual 0.49584 0.70416 > > Number of obs: 608, groups: Tattoo:(Socialgroup:Location2), 132; > Socialgroup:Location2, 22; Location2, 4; Year, 2 > > > > Fixed effects: > > Estimate Std. Error t value > > (Intercept) 4.852982 0.342364 14.175 > > AGECAT2OLD 0.000986 0.361951 0.003 > > AGECAT2YEARLING -0.203275 0.358971 -0.566 > > SexMale -0.137881 0.261931 -0.526 > > Location2A 3.978806 0.630652 6.309 > > Location2C -0.069353 0.444658 -0.156 > > Location2D 0.614917 0.479262 1.283 > > AGECAT2OLD:Location2A -0.441995 0.547521 -0.807 > > AGECAT2YEARLING:Location2A 0.221330 0.527840 0.419 > > AGECAT2OLD:Location2C -0.235146 0.434839 -0.541 > > AGECAT2YEARLING:Location2C 0.462657 0.357815 1.293 > > AGECAT2OLD:Location2D 0.094536 0.442264 0.214 > > AGECAT2YEARLING:Location2D 0.738882 0.375638 1.967 > > SexMale:Location2A 0.024425 0.575468 0.042 > > SexMale:Location2C 0.771228 0.351708 2.193 > > SexMale:Location2D -0.393576 0.364486 -1.080 > > AGECAT2OLD:SexMale -0.089071 0.325140 -0.274 > > AGECAT2YEARLING:SexMale -0.401467 0.304098 -1.320 > > > > The results are also different if location C or D are the reference levels > > > > > > Andrew Robertson > PhD student > Centre for Ecology and Conservation > University of Exeter, Cornwall Campus > Tremough, Cornwall. TR10 9EZ > UK > > Tel: 01326 371852 > Email: <mailto:ar...@exeter.ac.uk> ar...@exeter.ac.uk > Web page: > <http://biosciences.exeter.ac.uk/staff/postgradresearch/andrewrobertson/> > http://biosciences.exeter.ac.uk/staff/postgradresearch/andrewrobertson/ > > LinkedIn: <http://uk.linkedin.com/pub/andrew-robertson/39/91a/504> > http://uk.linkedin.com/pub/andrew-robertson/39/91a/504 > > > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. > -- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm [[alternative HTML version deleted]] ______________________________________________ R-help@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.