Anova 1 results into a matrix

조회 수: 3 (최근 30일)
Cside
Cside 2019년 10월 7일
답변: Michal 2019년 10월 7일
Hi,
I have a code that loops and returns with their respective Anova 1 analysis. How may I write for a code that automaticlly inputs the results into one matrix?
Thanks!

채택된 답변

Michal
Michal 2019년 10월 7일
Hi,
it depends on what results you would like to get.
You can get the full ANOVA table from anova1 as a cell array.
[~,table] = anova1(y)
Then you can simply store each ANOVA table in a cell array.
for i = 1:number_of_loops % number_of_loops should be equal to how many loops you want to run
[~,table] = anova1(y);
all_results{i} = table;
end
If you would like to get just one result from the ANOVA table you can store it in a matrix in a similar way to the above. Let's say you are interested in the F statistic:
for i = 1:number_of_loops % number_of_loops should be equal to how many loops you want to run
[~,table] = anova1(y);
F_statistic(i) = table{2,5}; % make sure you check that the F statistic of your ANOVA can be found at those indices - (2,5)
end
You can easily work out indices of any of the results by looking at the ANOVA table.
Hope this helps.

추가 답변 (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