# Re: [R] Dunn's post hoc test

From: IAIN GALLAGHER <iaingallagher_at_btopenworld.com>
Date: Tue 18 Oct 2005 - 05:29:38 EST

Thanks for your reply Hank. It's not really what I'm after (though it's good to know).

For the test ( as described in Statistics for the Biosciences by W. Gardiner. Prentice Hall, 1997) I have to rank my groups, calculate the average rank, then subtratc each average rank from every other. Any value greater than the test statistic is significant.

eg average rank difference table:

2 5 8 9

```---|------------------
2  -     3     6    7
|
5  -     -     3    4
|
8  -     -     -    1
|
9  -     -     -    -
```

|

I can't get my head around writing an algorithm for this if I have a vector of average ranks eg averank<- c(2,5,8,9).

I know I can address the vector by index and that this is probably the correct route but I can't get the indexing algorithm right!

I'm sure someone will point out somethng simple and I'll kick myself but the help would be appreciated.

Thanks again.

Iain Gallagher

• "Martin Henry H. Stevens" <HStevens@MUOhio.edu> wrote:

> I don't know Dunn's rank test, but the following
> substracts each of
> the sums of averanks from the next rank.
>
> cumsum(averank)[-length(averank)] - averank[-1]
>
> Hank
>
> On Oct 17, 2005, at 4:30 AM, Iain Gallagher wrote:
>
> > Hi Everyone.
> >
> > I am rather new to R and I've been trying to
> implement a function to
> > carry out the above test. For a couple of days now
> I've been stuck on
> > how to generate average rank differences.
> >
> > Say I have a vector of average ranks:
> >
> > averank<- c(2,5,9,12)
> >
> > I would like to subtract averank[1] from
> averank[2], averank[1] and
> > averank[2] from averank[3] and averank[1],
> averank[2] and averank[3]
> > from averank[4] etc (I know the syntax is wrong
> here... it's just for
> > illustration) but I can't work out how to do it.
> >
> > Ideally I would like to generate an array showing
> the differences
> > between the average ranks so I could tell at a
> glance which ones were
> > greater than my critical value
> >
> > I've been looking at loops etc but it's a little
> beyond me at the
> > moment. Thanks for any suggestions.
> >
> > Iain Gallagher
> > IIIR
> > Edinburgh University
> >
> > ______________________________________________
> > R-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> http://www.R-project.org/posting-
> > guide.html
> >
>
> Dr. Martin Henry H. Stevens, Assistant Professor
> 338 Pearson Hall
> Botany Department
> Miami University
> Oxford, OH 45056
>
> Office: (513) 529-4206
> Lab: (513) 529-4262
> FAX: (513) 529-4243
> http://www.cas.muohio.edu/~stevenmh/
> http://www.muohio.edu/ecology/
> http://www.muohio.edu/botany/
> "E Pluribus Unum"
>
>

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Oct 18 05:38:18 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:45 EST