[R] Contrast interaction effects in lmer object for reciprocal transplant experiment

From: Steven Brady <steven.brady_at_yale.edu>
Date: Mon, 21 Jun 2010 14:01:48 -0400


Dear All:

I am using lmer() {lme4} to analyze results from a reciprocal transplant experiment where the response variable is modeled as a function of two fixed effects and their interaction.

Example data follow:

#library(lme4)
#library(gmodels)

env=c("r","r","w","w","r","r","w","w","r","r","w","w","r","r","w","w")
# type of environment to where populations were transplanted (fixed
effect)
origin
=c("r","r","r","r","r","r","r","r","w","w","w","w","w","w","w","w") # type of environment from where populations originated (fixed effect) survival=c(rnorm(16,0.75, sd = 0.1)) #percent survival (response variable)
population
=c("a","a","a","a","b","b","b","b","c","c","c","c","d","d","d","d")
#local population (random effect)

exp=data.frame(pond=pond, env=env,origin=origin,survival=survival)
#make data frame

g<-lmer(survival~origin*env + (1|population), data = exp) # mixed model pvals.fnc(g) #evaluate fixed effects

My question is this:

How do I perform contrasts on the interaction of the fixed effects using, say estimable() in the library {gmodels}? I have seen how to do this for levels within a factor, however, I am unsure how to apply these to levels among factors (i.e. the interaction terms).

Biologically speaking, I am interested in evaluating the difference in survival between the two origin types in each of two types of environments. In other words:

  1. does origin r differ from origin w within env w? and,
  2. does origin r differ from origin w within env r?

Part of my misunderstanding concerns the reporting of the fixed effects of the model, which are named as the fixed term concatenated with a level (e.g. originw). Does the way lmer names the fixed effects influence the contrast matrix I should specify?

Many thanks in advance,

Steve Brady



Steven P. Brady, Ph.D. Candidate
School of Forestry & Environmental Studies Yale University
370 Prospect Street
New Haven, CT 06511

Email: steven.brady_at_yale.edu
Phone: 203-432-5321 Fax: 203-432-3929
Web: http://www.cbc.yale.edu/people/skelly/steveb.html



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. Received on Mon 21 Jun 2010 - 18:03:27 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 21 Jun 2010 - 19:10:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive