Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: Re: friedman test

 From "Joseph Coveney" To Subject st: Re: friedman test Date Thu, 19 Jul 2012 00:19:01 +0900

```Maria Letizia Bacchi Reggiani wrote:

I ‘ve some problems  performing Friedman test on STATA 11.
The STATA command help suggests to xpose, clear data and then to write friedman v?
In this way I obtain :

friedman v?
Friedman =  22.7333
Kendall =    0.8420
P-value =    0.0000

With  the form v1-v26 I obtain as result:

friedman v1-v26
Friedman =  59.5731
Kendall =    0.7638
P-value =    0.0000

Performing the same Friedman test with R and with Primer of Biostatistics I obtain a third result:
Friedman = 68.233
P-value =    0.0000

I’m a bit confused, could anybody help me?

--------------------------------------------------------------------------------

You can download the user-written command -emh- from SSC, which can perform Friedman's test, among other things.  The syntax for its use in Friedman's test is shown in the do-file below, which uses your dataset.  The results match those of R and the primer.

Joseph Coveney

clear *
set more off
input int(test1 test2 test3 test4)
0 8 72 900
0 2 48 155
0 25 45 350
0 15 35 900
0 170 720 900
100 200 250 2000
0 0 0 750
0 36 150 2300
0 0 0 550
0 30 300 950
0 60 0 950
0 0 36 170
0 0 0 400
0 0 0 850
0 0 0 60
0 50 200 200
0 87 240 240
0 20 500 800
0 0 10 550
0 200 250 450
0 0 400 850
0 0 0 750
0 0 100 750
0 0 350 600
0 0 15 850
0 40 400 480
end
// renvars test?, presub(test score)
forvalues i = 1/4 {
rename test`i' score`i'
}
generate byte pid = _n
quietly reshape long score, i(pid) j(test)
emh score test, strata(pid) anova trans(rank)
return list
exit

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```

• References:
• st: friedman test
• From: Maria Letizia Bacchi Reggiani <maria.bacchireggiani@unibo.it>