# Re: [R] how to specify a particular contrast

From: array chip <arrayprofile_at_yahoo.com>
Date: Thu, 17 Jan 2008 23:43:08 -0800 (PST)

I didn't set the variable "treat" as ordered factor, just ordinary factor. In my example, the 3 levels of "treat" are of equal distance in the order of from a to b to c. So my understanding is that a contrast in the form of "a+c-2*b=0" was to test a linear trend of the response variable among the 3 levels of "treat". However, this linear trend also includes a special situation where a=b=c, i.e. the response variable among the 3 levels are the same, which is contrary to the linear trend conclusion and is what I want to exclude. Hope my explanation helps. Thanks

• Ross Darnell <r.darnell_at_uq.edu.au> wrote:

> 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:
>
> obj<-aov(y~treat,data=dat)
> ### testing a=b=c
> summary(glht(obj, linfct= mcp
> (treat=c('a-b=0','a-c=0','b-c=0'))),test=Ftest())
> ### testing linear relationship among a,b and c
> summary(glht(obj, linfct= mcp
> (treat=c('a+c-2*b=0'))),test=Ftest())
>
> 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?
>
> Thanks
>
> John Zhang
>
>
>
>
>

> ____________
> Looking for last minute shopping deals?
>
> ______________________________________________
> 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.
>

Looking for last minute shopping deals?

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 Fri 18 Jan 2008 - 07:53:32 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 Fri 18 Jan 2008 - 09:30:06 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.