[R] how to specify a particular contrast

Ross Darnell r.darnell at uq.edu.au
Fri Jan 18 03:45:08 CET 2008

I don't quite follow what you are trying to do but the second contrast
has  a few interpretations with the same meaning in your case 

1) are the 2-1 and 3-2 differences  equal
2) lack of fit of a linear trend 
3) is there a quadratic response

If you declare your factor to be "ordered" then the default contrasts
will be poly()nomials.

Ross Darnell  

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of array chip
Sent: Friday, 18 January 2008 10:22 AM
To: r-help at stat.math.ethz.ch
Subject: [R] how to specify a particular contrast

Hi, I am running a simple one-way ANOVA with an
independent factot variable "treat" (3 levels: a, b
and c) and a response variable "y". I want to test a
linear relationship of the response among the 3 levels
of the variable "treat" (ordered a->b->c). I used
glht() from multcomp package. Later I found out I need
to exclude the situation where the response at the 3
levels of "treat" are equal. I can do separate
contrasts to test them separately:

  ### testing a=b=c
summary(glht(obj, linfct= mcp
  ### testing linear relationship among a,b and c
summary(glht(obj, linfct= mcp

Is there anyway to build one contrast that tests both
at the same time, i.e. just generate one single p
value. Because the ultimate purpose was to test the
linear relationship among the 3 levels of the variable
"treat". Or I am asking something that is non-sensible
to do?


John Zhang

Looking for last minute shopping deals?

R-help at r-project.org mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list