[R-sig-ME] contrasts lme
Etienne Laliberte
etiennelaliberte at gmail.com
Wed Sep 7 16:10:54 CEST 2011
Many thanks -- you've answered my question.
Cheers,
Etienne
-----Original Message-----
From: i white [mailto:i.m.s.white at ed.ac.uk]
Sent: Wednesday, 7 September 2011 5:47 PM
To: Etienne Laliberte; r-sig
Subject: Re: [R-sig-ME] contrasts lme
Etienne,
You are trying to set up a design matrix with 4 columns:
fac1 fac2 Design
A X 1 0 1 0
A Y 1 0 0 1
B X 0 1 1 0
B Y 0 1 0 1
but the columns of this matrix add to a constant 1, so lme drops one
column (3rd), leaving you with 3 parameters, fac1(A), fac1(B), and
fac2(Y), representing means for levels A and B of fac1, and the
difference between levels X and Y of fac2.
What is the hypothesis you want to test?
Etienne Laliberte wrote:
> I have two factors and what to test the null hypothesis that each term is
> equal to 0 (which in this case is meaningful). With one factor you just
add
> -1 to remove the intercept. However, with two factors I don't understand
the
> summary output. I'm obviously missing something re contrasts. An answer
to
> my question below would be much appreciated. Thanks in advance.
>
>
>
> # create dummy data
>
> fac1 <- rep(gl(2, 6, labels = c("A", "B")), 4 )
>
> fac2 <- rep(gl(2, 3, labels = c("X", "Y") ), 8 )
>
> block <- gl(4, 12)
>
> resp <- rnorm(length(fac1), mean = 10)
>
> dummy <- data.frame(resp, fac1, fac2, block)
>
>
>
> # load nlme
>
> library(nlme)
>
>
>
> # create lme model
>
> # no intercept, only fac1
>
> mod1 <- lme(resp ~ fac1 - 1, random = ~ 1 | block, data = dummy)
>
> summary(mod1)
>
> # here the null hypotheses being tested are that the terms for fac1A and
> fac1B are both = 0
>
> # this is what I want
>
>
>
> # but what about when there is another factor?
>
> # what are the null hypotheses with the terms, particularly fac2Y, and why
> is fac2X not listed?
>
> mod2 <- lme(resp ~ fac1 + fac2 - 1, random = ~ 1 | block, data = dummy)
>
> summary(mod2)
>
>
>
> Regards
>
> Etienne
>
>
>
>
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
More information about the R-sig-mixed-models
mailing list