[R] Newbie question on using friedman.test()

Robert Baer rbaer at atsu.edu
Wed Jan 18 00:48:20 CET 2006


?friedman.test

Says:
Description:
Performs a Friedman rank sum test with unreplicated blocked data.

Usage:
friedman.test(y, ...)

  y: either a numeric vector of data values, or a data matrix.

So assuming your data, d, is unreplicated blocked data, perhaps"
> d=as.matrix(d)
> friedman.test(d)
or simply,
friedman.test(as.matrix(d))
???



____________________________
Robert W. Baer, Ph.D.
Associate Professor
Department of Physiology
A. T. Still University of Health Science
800 W. Jefferson St.
Kirksville, MO 63501-1497 USA
----- Original Message ----- 
From: "Bill Kules" <wmk at takomasoftware.com>
To: <r-help at stat.math.ethz.ch>
Sent: Tuesday, January 17, 2006 12:16 PM
Subject: [R] Newbie question on using friedman.test()


> I am trying to use the friedman.test() on a data frame, d, but
> I am receiving the following error message:
>
>
> > d
>    AW HS IAC WA
> 1   6  8   3  5
> 2   2  2   3  6
> 3   7  7   8  3
> 4   8  5   4  5
> ....
> 20  2  5   2  7
> 21  7  7   6  7
> 22  7  8   6  8
> 23  6  8   4  5
> 24  5  7   5  2
> > friedman.test(d)
> Error in any(is.na(groups)) : argument "groups" is missing, with no
default
>
> I think I just need to convert the data frame to a matrix, and then
> friedman.test() will get the roups and blocks automatically.
>
> Question 1) Is my understanding correct?
>
> Question 2) What R function will convert the data frame to the matrix I
> need?
> I'm still figuring out the matrix functions, and I would appreciate any
> pointers or examples.  The help() section is sometimes a bit terse...
>
> Thanks in advance from a Newbie,
> Bill
>
> PS - to recreate the above data frame "d":
> d <-
> structure(list(AW = as.integer(c(6, 2, 7, 8, 8, 8, 7, 5, 3, 6,
> 8, 7, 6, 4, 8, 7, 8, 7, 7, 2, 7, 7, 6, 5)), HS = as.integer(c(8,
> 2, 7, 5, 4, 5, 7, 7, 2, 8, 4, 7, 8, 7, 6, 7, 5, 8, 8, 5, 7, 8,
> 8, 7)), IAC = as.integer(c(3, 3, 8, 4, 7, 5, 8, 3, 4, 3, 7, 4,
> 6, 5, 6, 7, 8, 6, 8, 2, 6, 6, 4, 5)), WA = as.integer(c(5, 6,
> 3, 5, 3, 6, 7, 8, 3, 5, 6, 7, 7, 7, 7, 6, 4, 7, 8, 7, 7, 8, 5,
> 2))), .Names = c("AW", "HS", "IAC", "WA"), row.names = c("1",
> "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13",
> "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24"
> ), class = "data.frame")
>
> ========
> Bill Kules
> Principal, Takoma Software, Inc., Takoma Park, MD
>   www.takomasoftware.com
> Ph.D. Candidate, University of Maryland Human-Computer Interaction Lab
>   www.cs.umd.edu/hcil
>
> wmk at takomasoftware.com
> (301) 405-2725 voice
> (301) 891-7271 voice + voicemail
> (301) 891-7273 fax
> (301) 755-7982 mobile
> ========
>
> ______________________________________________
> R-help at 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
>




More information about the R-help mailing list