kruskalwallis
Perform a Kruskal-Wallis test, the non-parametric alternative of a one-way analysis of variance (ANOVA), for comparing the means of two or more groups of data under the null hypothesis that the groups are drawn from the same population, i.e. the group means are equal.
kruskalwallis can take up to three input arguments:
kruskalwallis can return up to three output arguments:
If kruskalwallis is called without any output arguments, then it prints the results in a one-way ANOVA table to the standard output. It is also printed when displayopt is ’on’.
Examples:
x = meshgrid (1:6); x = x + normrnd (0, 1, 6, 6); [p, atab] = kruskalwallis(x); |
x = ones (50, 4) .* [-2, 0, 1, 5]; x = x + normrnd (0, 2, 50, 4); group = {"A", "B", "C", "D"}; kruskalwallis (x, group); |
Source Code: kruskalwallis
x = meshgrid (1:6); x = x + normrnd (0, 1, 6, 6); kruskalwallis (x, [], 'off'); Kruskal-Wallis ANOVA Table Source SS df MS Chi-sq Prob>Chi-sq --------------------------------------------------------- Columns 3284.00 5 656.80 29.59 1.77936e-05 Error 601.00 30 20.03 Total 3885.00 35 |
x = meshgrid (1:6); x = x + normrnd (0, 1, 6, 6); [p, atab] = kruskalwallis(x); Kruskal-Wallis ANOVA Table Source SS df MS Chi-sq Prob>Chi-sq --------------------------------------------------------- Columns 2841.00 5 568.20 25.59 1.06929e-04 Error 1044.00 30 34.80 Total 3885.00 35 |
x = ones (30, 4) .* [-2, 0, 1, 5]; x = x + normrnd (0, 2, 30, 4); group = {"A", "B", "C", "D"}; kruskalwallis (x, group); Kruskal-Wallis ANOVA Table Source SS df MS Chi-sq Prob>Chi-sq --------------------------------------------------------- Columns 98001.87 3 32667.29 80.99 0.00000e+00 Error 45988.13 116 396.45 Total 143990.00 119 |