[R-sig-ME] contrasts in lmer for a fix effect with 3 levels

Federico Calboli f.calboli at imperial.ac.uk
Tue May 20 23:56:41 CEST 2008


On 20 May 2008, at 22:16, Marcela A. Bustamante-Sanchez wrote:

> Dears lmers!
> I have a field experiment with a split plot design. I have blocks  
> in three different types of shurblands. In each shurbland-plot I  
> set up two sub-plots, with two types of cover vegetation (open and  
> close) and in each sub plot I sowed 20 seeds of a species of tree.  
> My response variable is the probability of germination. So, I have  
> two fixed factors: shurbland and cover, and one random factor block/ 
> shrubland. The following is my model:
>
>
>
> modela<-lmer(cbind(success, failures) ~ shrubland* cover+ (1 |  
> block/shrubland), family="binomial", data=Tod07)
>
> shrubland: tree levels (Bb, Bp, R)
>
> cover: two levels (open, close)
>
>
>
> I want to know if someone can explain or indicate me how to make  
> the contrasts or comparisons for the three levels in the shurbland  
> factor? I'm nwe using R so I have no idea how to make the  
> comparisons using these mixed models.

try:

contrasts(Tod07$shrubland)

this should give you the contrasts set for the levels in shrubland.  
If you want different contrasts you need to build a new matrix of  
contrasts (of the very same dimensions of the original contrasts matrix.

contrasts(Tod07$shrubland) = your.matrix

Obviously you need to know what kind of contrasts you want before...  
look around for orthogonal contrasts, I think that would be a good  
starting point.

Finally, this question is a general R question, it applies to lm()  
and similar functions outside the libraries lme4/nlme

HTH

F

--
Federico C. F. Calboli
Department of Epidemiology and Public Health
Imperial College, St. Mary's Campus
Norfolk Place, London W2 1PG

Tel +44 (0)20 75941602   Fax +44 (0)20 75943193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com




More information about the R-sig-mixed-models mailing list