[R-sig-eco] post hoc in Kruskal Wallis

Richard L. Boyce boycer at nku.edu
Fri Dec 2 15:10:15 CET 2011


Thanks, Dave! If I get a moment, I'll see if I can modify it for 
unbalanced designs--Rick

>Message: 1
>Date: Thu, 01 Dec 2011 10:27:20 -0700
>From: Dave Roberts <dvrbts at ecology.msu.montana.edu>
>To: r-sig-ecology at r-project.org
>Subject: Re: [R-sig-eco] post hoc in Kruskal Wallis
>Message-ID: <4ED7B8F8.1070801 at ecology.msu.montana.edu>
>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>If the design is balanced this function will work
>
>npcompare <- function (var,class)
>{
>      k <- length(table(class))
>      n <- length(var)/k
>
>      se <- sqrt((n*(n*k)*(n*k+1))/12)
>      rvar <- rank(var)
>
>      for (i in 1:(k-1)) {
>          left <- sum(rvar[as.numeric(class)==i])
>          for (j in (i+1):k) {
>              right <- sum(rvar[as.numeric(class)==j])
>              diff = abs(left-right)
>              cat(paste(i,j,left,right,diff,round(1-pt(diff/se,k),4),'\n'))
>          }
>      }
>      cat('\n')
>}
>
>It's not formatted very elegantly, but it works.
>
>Dave R.
>
>On 11/24/2011 08:01 AM, Richard L. Boyce wrote:
>>  Zar, in Biostatistical Analysis, has a Tukey-like test that is highly
>>  recommended. You may need to do it by hand, but it is quite easy.
>>
>>>  Message: 5
>>>  Date: Wed, 23 Nov 2011 18:21:54 +0100
>>>  From: "Jakub Szymkowiak"<qbaszym at tlen.pl>
>>>  To:<r-sig-ecology at r-project.org>
>>>  Subject: [R-sig-eco]  post hoc in Kruskal Wallis
>>>  Message-ID:<C8041F4B78EB487C8707E72114C3F4CF at komp>
>>>  Content-Type: text/plain; format=flowed; charset="iso-8859-1";
>>>	reply-type=original
>>>
>>>  Hi,
>>>  does anyone know, how can I perform post-hoc tests (especially Least
>>>  Significant Difference and Sheffe Test) for results from Kruskal-Wallis
>>>  test? In KruskaI-Wallis test I found some significant differences between
>>>  tested groups, but I want to know between which groups this difference is
>>>  really signifficant.
>>>
>>>  Cheers,
>>>  Jakub
>>
>
>--
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>David W. Roberts                                     office 406-994-4548
>Professor and Head                                      FAX 406-994-3190
>Department of Ecology                         email droberts at montana.edu
>Montana State University
>Bozeman, MT 59717-3460

-- 
================================
Richard L. Boyce
Director, Environmental Science Program
Associate Professor
Department of Biological Sciences
Northern Kentucky University
Nunn Drive
Highland Heights, KY  41099  USA

859-572-1407 (tel.)
859-572-5639 (fax)
boycer at nku.edu
http://www.nku.edu/~boycer/
=================================

"One of the advantages of being disorderly is that one is constantly 
making exciting discoveries." - A.A. Milne



More information about the R-sig-ecology mailing list