|
The Following is the code and example for Friedman test
SAS program for the Friedman Test
DATA Fried;
INPUT BLOCK $ TRTMENT $ YIELD @@;
CARDS;
1 A 32.6 1 B 36.4 1 C 29.5 1 D 29.4
2 A 42.7 2 B 47.1 2 C 32.9 2 D 40.0
3 A 35.3 3 B 40.1 3 C 33.6 3 D 35.0
4 A 35.2 4 B 40.3 4 C 35.7 4 D 40.0
5 A 33.2 5 B 34.3 5 C 33.2 5 D 34.0
6 A 33.1 6 B 34.4 6 C 33.1 6 D 34.1
run;
PROC RANK;
BY BLOCK;
VAR YIELD;
RANKS RYIELD;
RUN;
proc freq;
tables block*trtment*ryield / noprint cmh;
title 'Friedman''s Chi-Square';
run;
proc means median;
class trtment;
var yield;
run;
Output
Friedman's Chi-Square
The FREQ Procedure
Cochran-Mantel-Haenszel Statistics (Based on Table Scores)
Statistic Alternative Hypothesis DF Value Prob
---------------------------------------------------------------
1 Nonzero Correlation 1 0.7448 0.3881
2 Row Mean Scores Differ 3 12.6207 0.0055
3 General Association 12 27.7500 0.0060
Total Sample Size = 24
The MEANS Procedure
Analysis Variable : YIELD
N
TRTMENT Obs Median
-------------------------------
A 6 34.2000000
B 6 38.2500000
C 6 33.1500000
D 6 34.5500000
-------------------------------
|