%% 3-way ANOVA on the original data
% y -- biomas
y=[.92 .97 1.09 .94 1.34 1.44 .94 1.22 1.02 1.06 ...
1.35 1.41 1.53 1.55 1.40 1.51 1.48 1.52 1.42 1.12 ...
1.39 1.12 1.43 1.61 .36 .32 1.01 .74 1.27 1.1 ...
1.06 1.04 1.25 1.18 1.3 1.11 .83 .86 1.37 1.27 ...
1.48 1.22 1.6 1.56 1.18 1.21 1.39 1.30 1.38 1.28 ...
1.4 1.34 1.32 1.45 1.37 1.43 1.19 1.35 .83 .73 1.43 ...
1.53 1.58 1.42 1.49 1.46 1.34 1.34 1.29 1.29 1.44 1.54];
plant = [ones(1,24) 2*ones(1,24) 3*ones(1,24)]; %Variaties of Medicago Sativa %:factor A
S =[ones(1,12) 2*ones(1,12)];
Season = [S S S]; %Different Seasons : Exp I,II: factor B
Ba=[1 1 2 2 3 3 4 4 5 5 6 6];
Bacterium = [Ba Ba Ba Ba Ba Ba]; %Strains of Rhizobium: factor C
p = anovan(y,{plant Season Bacterium},...
'varnames',{'PlantVariety','Season','Bacterium'},...
'model','linear');
