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

조회 수: 10 (최근 30일)
NA
NA 2020년 9월 9일
댓글: NA 2020년 9월 10일
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