How should I organise data for unbalanced two factor anova analysis (anovan)

9 次查看(过去 30 天)
Hi All,
I have two groups (control; n=13 and interven; n=12). For each group, I have collected the peak amplitudes of each subject at four different stimulus strengths. I would like to conduct a two way anova analysis: group and intensity. I am aware that for an unbalanced multifactorial anova I could use the function 'anovan' in MATLAB. However, I am a bit confused as to how to organise my data so that I can conduct the analysis correctly.
Currently I have created two tables (per group), with each column representing a different intensity.
peakCON = table(idx0p4CON,idx0p6CON,idx0p8CON,idx1p2CON); %13x4; control group - 4 different intensities
peakFA = table(idx0p4FA,idx0p6FA,idx0p8FA,idx1p2FA); %12x4; intervention group - 4 different intensities
STIM = [peakCON(:,1),peakFA(:,1),peakCON(:,2),peakFA(:,2),peakCON(:,3),peakFA(:,3),peakCON(:,4),peakFA(:,4)]; %concatenate the CON and INTERV group
GRP = [1 2 1 2 1 2 1 2]; %Grouping variables
%P=anovan(STIM,GRP);
When I concatenate my tables at 'STIM' I get an error saying that the rows are unequal (obviously). I am unsure how to proceed from this point, and would appreciate any help.

采纳的回答

Jeff Miller
Jeff Miller 2020-9-9
To start with, you have to make a table with 25 lines, one for each member of each group, and 4 variables for intensity plus one categorical variable for group. The code should look something like this:
peakCON = table(idx0p4CON,idx0p6CON,idx0p8CON,idx1p2CON); %13x4; control group - 4 different intensities
peakCON.Properties.VariableNames = {'idx0p4', 'idx0p6', 'idx0p8', 'idx1p2'};
peakCON.Group = ones(height(peakCON),1);
peakFA = table(idx0p4FA,idx0p6FA,idx0p8FA,idx1p2FA); %12x4; intervention group - 4 different intensities
peakFA.Properties.VariableNames = {'idx0p4', 'idx0p6', 'idx0p8', 'idx1p2'};
peakFA.Group = 2 * ones(height(peakFA),1);
STIM = [peakCON; peakFA];
STIM.Group = categorical(STIM.Group);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Analysis of Variance and Covariance 的更多信息

标签

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by