Advanced tables and statistics > Descriptive statistics > Friedman’s two-way analysis of variance
 
Friedman’s two-way analysis of variance
Quick reference
To request Friedman’s two-way analysis of variance, type:
stat=friedman [, element_text] [;options]
as an element in the axis.
More information
Friedman’s test is performed in Quantum using an axis-level statistic. It is used to test whether the location (average value) of a variable differs between a set of matched samples. Usually, the samples are a set of test scores obtained under different conditions, or given to different products, by the same set of respondents. The data can therefore be matched by comparing each respondent’s score for one product or test with the same respondent’s score for the other products or tests.
The test is performed by ranking each set of scores — that is, giving the value 1 to the lowest score given by each respondent, 2 to the next lowest, and so on. (Sometimes, the data is already in this form; for example, respondents may themselves have been asked to rank their preferences for a set of products.)
Friedman’s tests are produced by a stat=friedman element in the axis. Each such element must be preceded by at least two basic count elements identifying the products, tests and so on to be compared. Each element must contain an inc= to calculate the sum of the ranks given to the item specified in that element (as shown in the example below).
If your data columns contain scales which are not ranked (such as scores), you must use statements in the Quantum edit to set the ranks — numbers from 1 upwards — into variables. These can then be used to define the incs on the n statements used by the test. For example:
data rnk 4s
ed
if (c131'9') set rnk1'1'
if (c131'7') set rnk1'2'
The first element in the axis must be a base element: other base elements may be present, in which case they define the beginning of additional segments in the axis.
Notes
If there is no overall tendency for one product (or test or whatever) to score or be ranked more highly than another, the value of Friedman’s statistic is zero. On the other hand, the greater the disagreement between the ranks due to the different respondents, the greater this value is.
It makes no difference whether ranks are assigned by giving a rank of 1 to the lowest score or preference and so on upwards, or to the highest score or preference and so on downwards. Though the sums of ranks will, of course, be different, the value of Friedman’s statistic in each case is exactly the same.
Friedman’s test is extremely sensitive to any errors in assigning ranks to the elements in the axis or segment. Each respondent must have assigned a score or rank to each item in the axis or segment.
If the ranks are read directly from columns of data, you must ensure that the columns contain one rank for each item and that the ranks the respondent has given are valid. For example, when ranking four products on a scale of 1 to 4, the respondent must have ranked each product within the range 1 to 4.
If the data columns contain scores, your Quantum edit must convert these correctly into a valid set of ranks. Normally these are exactly one of each of the numbers from 1 to the number of elements; thus if there are four products which have been ranked, there would be 4 elements in the axis or segment of the axis, and, for each respondent, each element would contain one of the numbers 1 through 4.
If some products have not been ranked or invalid ranks are present in any of the data columns, Friedman’s statistic is incorrect.
A respondent may assign the same rank to more than one product.
In order for the significance level associated with this statistic to be correct, there should be a minimum of 10 respondents who have assigned scores or ranks to all the items in the axis or segment.
Elements whose cells are all zero are included in the calculation of this statistic.
Example
In the example below, respondents have expressed their preference among four washing powders by giving the one they use most a value of 1, the next a value of 2, then 3 and 4. You can write a section in the Quantum edit to check that these values result in a valid product ranking, and then construct an axis which sums the ranks given to each product, and performs Friedman’s test on the results.
The resulting Quantum program is:
ed
r sp '1/4' o c(29,32)
c81 = xor(c29,c30,c31,c32)
if (c81 = '1/4') go to 5
write c(29,32) $product ranking incorrect$
5 continue
end
tab prdrank age
ttlProduct Preference
ttlBase: All Respondents
l prdrank
n10Base
n01Washo;c=c29'1/4';inc=c29
n01Suds;c=c30'1/4';inc=c30
n01Gleam;c=c31'1/4';inc=c31
n01Sparkle;c=c32'1/4';inc=c32
n03
stat=friedman,Friedman value;dec=2
n33Sig. level
l age
col 10;Base;18–24;25–34;35–44;45–54;55+
and it produces:
Product Preference
Base: All Respondents

                  Base    18-24    25-34    35-44    45-54      55+

Base               650       96      194       91      126       98
Washo             2072      329      672      311      432      328
Suds              1649      261      506      250      342      290
Gleam              862      137      284      129      180      132
Sparkle           1467      233      478      220      306      230

Friedman value  750.64   118.88   234.62   113.65   155.85   134.13
Sig. level       0.000    0.000    0.000    0.000    0.000    0.000
All the results in this table are highly significant. It shows more than 99.9% confidence that there are significant differences in the sample as a whole as well as in all of the individual age groups. This means that there is strong evidence that there are differences between the ranks that the respondents have given each of the brands.
See also
Descriptive statistics