I have one experiment with n=8 subjects. Each subject has passed m tests, and their performance is measured. How can I compare all subjects? Let's say I don't expect any significant difference between subjects.
-
1$\begingroup$ What do you want to compare? What question do you want to answer with the comparison? $\endgroup$– SvanteCommented Nov 2, 2014 at 13:15
-
$\begingroup$ @ Ehsan: your feedback will be appreciated. $\endgroup$– rnsoCommented Nov 4, 2014 at 5:25
2 Answers
Following may be helpful (taking 4 subjects and 3 tests) (code is in R):
> ddf
id t1 t2 t3
1 a 1 2 3
2 b 2 5 4
3 c 3 2 5
4 d 4 5 2
>
> dput(ddf)
structure(list(id = structure(1:4, .Label = c("a", "b", "c",
"d"), class = "factor"), t1 = 1:4, t2 = c(2L, 5L, 2L, 5L), t3 = c(3L,
4L, 5L, 2L)), .Names = c("id", "t1", "t2", "t3"), class = "data.frame", row.names = c(NA,
-4L))
>
> library(reshape2)
> mm = melt(ddf, id='id')
> mm
id variable value
1 a t1 1
2 b t1 2
3 c t1 3
4 d t1 4
5 a t2 2
6 b t2 5
7 c t2 2
8 d t2 5
9 a t3 3
10 b t3 4
11 c t3 5
12 d t3 2
>
applying friedman test:
> friedman.test(value ~ id | variable, data=mm)
Friedman rank sum test
data: value and id and variable
Friedman chi-squared = 2.5714, df = 3, p-value = 0.4625
or:
> friedman.test(value ~ variable | id, data=mm)
Friedman rank sum test
data: value and variable and id
Friedman chi-squared = 1.5, df = 2, p-value = 0.4724
Assuming you are comparing multiple test scores among subjects (ie their performance for each test was measured), you can do a one-way ANOVA or Kruskal-Wallis with subjects as factors and test scores as response variables. (The interesting point here is that 'independence' assumption could be redefined as making sure subjects don't learn on each consecutive test; if they do, tests need to have been given in the identical order, since there are no df for modeling repeated measures structure.)