How do I perform unbalanced ANOVA ?

56 vues (au cours des 30 derniers jours)
Simo
Simo le 22 Oct 2014
Hi! I have 3 vectors of data (each vector has a different number of data) and I'd like to perform ANOVA. How do I do it?

Réponses (3)

Hanling Su
Hanling Su le 10 Fév 2020
Hey you can use anova1 but assign specific group variable, for example, you can create two vector, the first one is the observations of your sample, group by group data = [x11, x12, ... x120, x21, x22, ... x227, x31, x32, .. , x317]. And you create a correspongding group vector, for this example group = [1,1,1...,1, 2, 2, ... , 3, 3, ...], as long as the observations have the same index as its group, you can use anova1(data, group), it will automatically group the data for you.

the cyclist
the cyclist le 23 Oct 2014
If you have the Statistics Toolbox, you can use the anovan function to do unbalanced ANOVA.

Samar Ragab
Samar Ragab le 22 Sep 2019
try this ,
g1=ones(1,size(classA3,1));
g2=2*ones(1,size(classB3,1));
g3=3*ones(1,size(classC3,1));
p1=zeros(1,26);
for i=1:26 %%%crossponding to features numbers(columns)
x=[classA3(:,i);classB3(:,i);classC3(:,i)]' ;
g=[g1,g2,g3];
p1(i)=anova1(x,g,'off');
end

Catégories

En savoir plus sur Analysis of Variance and Covariance dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by