to run NaN values with anova1

조회 수: 24 (최근 30일)
Cside
Cside 2019년 9월 9일
댓글: Cside 2019년 9월 9일
Hi, I have a matrix (8 x 621) and would like to run Anova1 between the 8 groups (rows). I have attached how the dataset looks like but when I run anova1, keyed in
p= anova1(dataset)
my p-value is 0. This does not seem right, may I know how I should correct it?
Thank you! :)

채택된 답변

Neuropragmatist
Neuropragmatist 2019년 9월 9일
As per the anova1 help it expects groups to be arranged in columns, not rows:
"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.
This form of anova1 is appropriate when each group has the same number
of elements (balanced ANOVA)."
So by simply transposing your matrix I get:
load('testdataset.mat')
P = anova1(testdatasetpfc_57_n1')
Picture1.png
The problem was not actually related to the NaN values because anova1 automatically ignores them.
If you did want to remove the NaNs you could follow this procedure using the 'groups' input to anova1:
load('testdataset.mat')
groups = repmat(1:8,size(testdatasetpfc_57_n1,2),1)';
P = anova1(testdatasetpfc_57_n1(:),groups(:))
Hope this helps,
M.
  댓글 수: 1
Cside
Cside 2019년 9월 9일
wow this helped me a lot. Thank you so much! :)) really appreciate it

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Analysis of Variance and Covariance에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by