Dear all,
I would like to run a linear model which includes two factors:
- The first one has two levels, including a reference level. Thus I have to use
the treatment contrast (contr.treatment, reference level effect = 0, then the
intercept).
- The second is a 6-level factor without reference contrast nor order. So, I
would like to use sum contrat: sum of the effects = 0.
The problem arises when it comes to the coefficient test. I understand it is not
relevant to test the reference level for the first factor as the reference level
is set to 0. However, using sum contrast for the second factor, I would have
expected the test of each level to be included in the classical summary print of
the lm function result but it is not. And here is my problem, how can I have
every coefficients tested and printed in the summary output when my factor is
studied from this sum.contrast standpoint?
Here is an example from a previous thread:
(http://comments.gmane.org/gmane.comp.lang.r.general/258886)
=============================> x <-
as.factor(c(1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3))> y <- c(1.1,1.15,1.2,1.1,1.1,1.1,1.2,1.2,1.2,2.1,2.2,2.3,2.4,2.5,
> + 2.6,2.7,2.8,2.9,3,3.1)
> test <- data.frame(x,y)
> reg1 <- lm(y~C(x,contr.sum),data=test)
> summary(reg1)
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.63333 0.06577 24.834 8.48e-15 ***
C(x, contr.sum)1 -0.48333 0.10792 -4.479 0.00033 ***
C(x, contr.sum)2 -0.48333 0.08936 -5.409 4.70e-05 ***
=============================
How can I include the third factor level in this table?
I fill the answer provided in this previous thread is relevant for
contr.treatment but not for contr.sum. Am I right? Or can you explain me?
Many thanks,
Fanch
This message and any attachment are intended solely for the addressee
and may contain confidential information. If you have received this
message in error, please send it back to me, and immediately delete it.
Please do not use, copy or disclose the information contained in this
message or in any attachment. Any views or opinions expressed by the
author of this email do not necessarily reflect the views of the
University of Nottingham.
This message has been checked for viruses but the contents of an
attachment may still contain software viruses which could damage your
computer system, you are advised to perform your own checks. Email
communications with the University of Nottingham may be monitored as
permitted by UK legislation.