"Walk" wrote in message <email@example.com>... > I have 3 vectors > a=[1 2 3 4 5]; > b=[2 4 6 8 10 12 14 16]; > c=[1 2 4 8 16 32]; > > All I want to do is determine whether or not there is evidence to conclude whether these samples come from the same distribution. With only two vectors, this would be done with ttest2(a,b). How do I expand this into checking between 3 or more vectors? From what I've read, anovan is supposed to do this, but when I read the documentation and look at the example, it appears to be meant for something entirely different, or is explained in a way that I can't follow. Unfortunately, all of the other example's I've managed to find simply regurgitate this one example, which is of no use to me. Am I missing something obvious, or do I have to go through ttest2 and compare a to b, then a to c, then b to c?
You can use the anova1(X) function. From the Matlab help: "In a one-way analysis of variance, you compare the means of several groups to test the hypothesis that they are all the same, against the general alternative that they are not all the same".
You should arrange your vectors in a matrix, but remember to put NaNs to fill in shorter vectors. Using your example vectors : X=[... 1 2 3 4 5 NaN NaN NaN; ... 2 4 6 8 10 12 14 16 ;... 1 2 4 8 16 32 NaN NaN]';
p = anova1(X);
Look at the Matlab help for interpreting the p-value. You might want to look at the kruskalwallis() function as well (a non-parametric version of the ANOVA).