MATLAB Answers

ANOVA returning p equal to 0?

30 views (last 30 days)
Happy Bear
Happy Bear on 20 Jun 2020
Commented: Happy Bear on 22 Jun 2020
I have a matrix 1024 x 3, looking a bit like this:
I want to compare the 3 columns so I applied ANOVA, by doing so:
p_value = anova1(matrix_slopes);
The p_value returns as 0. Is this normal?

Accepted Answer

John D'Errico
John D'Errico on 20 Jun 2020
I lack your data. And I see very little of your 1024 rows of data to know enough to answer. But, from what I see, you ask if this is normal. And the answer (lacking your data) is problably an equivocally stated, POSITIVELY YES. It seems to be totally normal. Maybe. Why?
You have 3 groups of data, with 1024 points sampled in each group. From what little I can see (i.e., 21 out of 1024 data points in those samples), it appears the 3 sets have different means, sufficiently different that they are clearly not from the same populations. Therefore, comparing those means and variances, assuming the data is normally distributed (what degree of faith can I have these assumptions are valid?) then as you used it, anova1 is designed to answer the question:
anova1 performs a one-way ANOVA for comparing the means of two or more
groups of data. It returns the p-value for the null hypothesis that the
means of the groups are equal.
P = anova1(M) for a matrix M treats each column as a separate group,
and determines whether the population means of the columns are equal.
Based on your data and assumptions, the three groups seem to have quite distinct mean values. That p-value suggests this is the case. Given 1024 data points, they would need to be far more consistent to have a non-zero p value.
For example, consider a case where I know in advance that three groups DO all have the same identical population means.
X = randn(1024,3);
>> mean(X)
ans =
0.02225266251095 -0.050980912995072 -0.00914143034389507
>> p = anova1(X)
p =
So even knowing the three groups are in fact from the same identical population, with 1024 points in each group, they had better be dead on for anova1 to agree they may have had the same means.
As I said, I don't have your data to attempt any sort of analysis. But I seriously doubt the means of those three columns are consistent with the null hypothesis of equal means. You have a lot of data, and it is pretty noisy from what I see, and I seriously doubt it is even close to normally distributed.
  1 Comment
Happy Bear
Happy Bear on 22 Jun 2020
Thank you so much for taking the time to explain me all of this, my data is indeed super noisy and I should have expected it.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!