# st: output and friedman test

 From "Sarah A. Mustillo" To statalist@hsphsun2.harvard.edu Subject st: output and friedman test Date Mon, 05 Apr 2004 12:03:29 -0400

```Many thanks Sara,sorry for my persists question,but I'm a student in
crisis... How do you export to excell the tables of the test's output??
And then, do you know anything about Friedman test in Stata??
```

I've never used a Friedman test before, but I did a quick search of the UCLA Stat Computing website and found this brief description:

"You perform a Friedman test when you have one within-subjects independent variable with two or more levels and a dependent variable that is not interval and normally distributed (but at least ordinal)."

Then I did

.net search friedman

and got a hit for -snp2-

Here is the help file:

display remote .hlp file
---------------------------------------------------------------------------
------

Note: Some links below may not work because you have not yet chosen to install
this package.

http://www.stata.com/stb/stb3/snp2/friedman.hlp:
Friedman's Analysis of Variance Test (and Kendall's Coefficient of Concordance)
---------------------------------------------------------------------------
----

friedman varlist {in range] [if exp]

friedman estimates Friedman's nonparametric two-way analysis of variance
and Kendall's Coefficient of Concordance (a descriptive measure of the
agreement between k sets of rankings). The two tests are equivalent and one
p-value is given for both. Note the the value of Kendall's statistic must be
between 0 and 1 and therefore may be easier to interpret.

Missing values are not allowed. I have tried to trap this, but may not find
all cases--if you ever obtain a negative result for the test statistics, then
you have at least one missing value.

For Kendall's coefficient, the variables are the rankers or judges or tests,
while the cases are the things being judged or ranked. For example, one
common use is to compare the rankings of students on each of several tests;
the following is taken from Gibbons, JD (1985), Nonparametric Statistical
Inference, 2nd edition, NY: Marcel Dekker, Inc., pp. 326-327.

S t u d e n t
--------------------------------------------
T E S T 1 2 3 4 5 6 7 8
-----------------------------------------------------
1 90 60 45 48 58 72 25 85
2 62 81 92 76 70 75 95 72
3 60 91 85 81 90 76 93 80

If you enter this as three variables, then you can just type in
friedman varlist
and all is fine. If you enter the data as 8 variables, one per student, then
use the xpose, c command first. You can then enter the friedman command,
as above. Note that if you need to transpose the data you should first
eliminate all variables that you will not be analyzing. Otherwise you may get
a surprise.

The above data set is included as gibbons2.dta--as 8 variables. I also
include Gibbons' example Friedman data set from p. 325 of her book as
gibbons1.dta. This one also needs to be transposed prior to testing. This
code is written expecting the raters to be the variables. This is because the
genrank program ranks variables across cases, not the other way around. Note
that in other programs you would do things differently--thus, in SYSTAT enter
this data set as 8 variables to obtain the same results as below.

The results from the above data are:
Friedman = 2.8889
Kendall = 0.1376
p-value = 0.8951

Kendall's coefficient of concordance ranges from 0 to 1, with 0 meaning no
agreement across raters (judges). The null hypothesis (Friedman) is that the
treatments are equal; the null hypothesis (Kendall) is that there is no
agreement between rankings or test results.

I do not produce the sums of ranks for each case, though other software does.
either just before or just after the current display lines).

The p-value is an approximation, though it appears to be pretty good as long
as there are at least 8 cases and 3 variables.

WARNING: do not add "compress" or in any other way try to change the code so
that the new variables are bytes rather than floats--your answer will be
WRONG! (Note that all new variables are dropped at the end of the ado file
anyway.)
(remote file ends)

I do not know how to export the output from a test command. Sorry!

Sarah

--On Monday, April 05, 2004 5:52 PM +0200 fabiopericolini@fastwebnet.it wrote:

```Many thanks Sara,sorry for my persists question,but I'm a student in
crisis... How do you export to excell the tables of the test's output??
And then, do you know anything about Friedman test in Stata??

Many many thanks.

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

```
```

Sarah A. Mustillo, Ph.D
Department of Psychiatry and Behavioral Sciences
Duke University School of Medicine
Box 3454
Durham NC 27710

919 687-4686 x231
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```

• References: