[R] kruskal test in R

C.H. chainsawtiney at gmail.com
Fri Nov 7 03:27:30 CET 2008


Are you dealing with some rainfall data for your schoolwork?
Few days ago, somebody asked exactly the same question.

read this one to know how to calculate the H value (An Alternative
Formula for the Calculation of H)
http://faculty.vassar.edu/lowry/ch14a.html

You can calculate the rank by rank()

> rain <- c(1,4,7,8,10,10,20,20,30,51)
> gp <- c(1,1,1,2,2,2,2,3,3,3)
> rain.rank <- rank(rain)

You can extract the rank of each gp by

> rain.rank[gp==1]

and the total rank for each gp (Tg) by

> sum(rain.rank[gp==1])

You can square it using the usual ^2

Once you can obtain the H value, you can calculate the p using pchisq command.
you can use ?pchisq to read the help file.

If you still don't know how to do it, please ask your tutor.

On Fri, Nov 7, 2008 at 8:53 AM, Pang Iverson <iverson0822 at hotmail.com> wrote:
>
> Hi,
> i have a question in R,
> How and what command you need to do to run a kruskal-wallis test without the built in command 'kruskal.test'?
> many thanks.
> _________________________________________________________________
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>



-- 
CH Chan
Research Assistant - KWH
http://www.macgrass.com



More information about the R-help mailing list