Categories &

Functions List

Function Reference: friedman

statistics: p = friedman (x)
statistics: p = friedman (x, reps)
statistics: p = friedman (x, reps, displayopt)
statistics: [p, tbl] = friedman (…)
statistics: [p, tbl, stats] = friedman (…)

Performs the nonparametric Friedman’s test to compare column effects in a two-way layout. friedman tests the null hypothesis that the column effects are all the same against the alternative that they are not all the same.

friedman requires one up to three input arguments:

  • x contains the data and it must be a matrix of at least two columns and two rows.
  • reps is the number of replicates for each combination of factor groups. If not provided, no replicates are assumed.
  • displayopt is an optional parameter for displaying the Friedman’s ANOVA table, when it is ’on’ and suppressing the display when it is ’off’ (default).

friedman returns up to three output arguments:

  • p is the p-value of the null hypothesis that all group means are equal.
  • tbl is a table containing the results of the Friedman’s test in ANOVA table format. The table includes columns for Source, SS, df, MS, Chi-sq, and Prob>Chi-sq with rows for Columns, [Interaction], Error, and Total.
  • stats is a structure containing statistics useful for performing a multiple comparison of medians with the MULTCOMPARE function.

If friedman is called without any output arguments, then it prints the results in a Friedman’s ANOVA table to the standard output.

Examples:

 
 load popcorn;
 friedman (popcorn, 3);
 
 
 [p, anovatab, stats] = friedman (popcorn, 3);
 disp (p);
 

See also: anova2, kruskalwallis, multcompare

Source Code: friedman

Example: 1

 

 load popcorn;
 friedman (popcorn, 3);

  4x6 table

        Source           SS       df      MS       Chi_sq     Prob_Chi_sq    
    _______________    _______    __    _______    _______    ___________    

    {'Columns'    }      99.75     2     49.875    13.7586     0.00102885    
    {'Interaction'}          0     1          0          0              1    
    {'Error'      }    16.1667    12    1.34722          0              0    
    {'Total'      }        116    17          0          0              0    

                    

Example: 2

 

 load popcorn;
 [p, atab] = friedman (popcorn, 3);
 disp (p);

1.0289e-03