# How to make Anova table for data from a factorial experiment

8 ビュー (過去 30 日間)
Scott MacKenzie 2021 年 4 月 28 日
コメント済み: Scott MacKenzie 2021 年 5 月 5 日
I'd like to know how MATLAB can be used to create an Anova table like this
% ANOVA_table_for_Entry Speed (wpm)
% =================================================================================
% Effect df SS MS F p
% ---------------------------------------------------------------------------------
% Participant 15 1424.418 94.961
% Layout 1 103.298 103.298 12.038 0.0034
% Layout_x_Par 15 128.717 8.581
% Trial 4 87.443 21.861 6.108 0.0003
% Trial_x_Par 60 214.745 3.579
% Layout_x_Trial 4 17.638 4.409 1.003 0.4130
% Layout_x_Trial_x_Par 60 263.701 4.395
% =================================================================================
from a data set like this:
11.44 14.93 12.00 12.54 16.85 8.21 11.21 9.67 8.55 9.87
15.76 13.86 14.27 14.72 13.90 7.08 9.97 12.29 11.34 14.21
...
10.15 9.51 12.28 15.27 12.98 9.42 8.70 10.18 13.94 11.10
The data form a 16 x 10 table. The full data set is in the attached file.
About the data: The data are from a 2 x 5 within-subjects factorial experiment with 16 participants. Each value is the measured entry speed (in words per minute) for a particular participant and test condition. There are 16 rows of data, one for each participant. There are 10 columns of data, one for each test conditions, as now described. The were two independent variables: Layout with 2 levels (Opti and Metropolis) and Trial with 5 levels (T1, T2, T3, T4, T5). The trial data are nested within the layout data. In other words, the layout data are in columns 1-5 (Opti) and 6-10 (Metropolis), and within each set are the data for the five trials.
About the Anova table: The Anova table was generated from this data set, but not using MATLAB.
I'm using MATLAB more and more these days for many analyses and I'm wondering if I can extend my use of MATLAB into the realm of hypothesis testing. Hence this question. Thanks in advance for your help.

サインインしてコメントする。

### 採用された回答

Jeff Miller 2021 年 4 月 28 日
x.Properties.VariableNames = {'o1','o2','o3','o4','o5','m1','m2','m3','m4','m5'};
withinDesign = table([1 1 1 1 1 2 2 2 2 2]',[1:5 1:5]','VariableNames',{'Layout','Trial'});
withinDesign.Layout = categorical(withinDesign.Layout);
withinDesign.Trial = categorical(withinDesign.Trial);
rm = fitrm(x,'o1-m5~1','WithinDesign',withinDesign);
ranova(rm,'WithinModel','Layout*Trial')
##### 10 件のコメント表示非表示 9 件の古いコメント
Scott MacKenzie 2021 年 5 月 5 日
Thanks for the extra details, Christophe. I'd have never figured that out. Cheers.

サインインしてコメントする。

### Community Treasure Hunt

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

Start Hunting!

Translated by