% M-script to test the anovan and multicompare functions
% Authors: M. Borgo ? A. Soranzo ? M. Grassi
small_yellow = [300 287 301 400 211 399 412 312 390 412];
small_red = [240 259 302 311 210 402 390 298 347 380];
small_black = [210 230 213 210 220 208 290 300 201 201];
big_yellow = [289 289 300 402 251 389 422 332 360 422];
big_red = [210 229 300 301 200 340 350 290 317 320];
big_black = [226 220 253 218 260 228 380 300 221 211];
nsubjsy=10;
nsubjsr=10;
nsubjsb=10;
nsubjby=10;
nsubjbr=10;
nsubjbb=10;
sizesmall=repmat({'small'},nsubjsy+nsubjsr+nsubjsb,1);
sizebig=repmat({'big'},nsubjsy+nsubjbr+nsubjbb,1);
Size=[sizesmall; sizebig];
yellowsmall=repmat({'yellow'},nsubjsy,1);
redsmall=repmat({'red'},nsubjsr,1);
blacksmall=repmat({'black'},nsubjsb,1);
yellowbig=repmat({'yellow'},nsubjby,1);
redbig=repmat({'red'},nsubjbr,1);
blackbig=repmat({'black'},nsubjbb,1);
Color=[yellowsmall; redsmall; blacksmall; yellowbig; redbig; blackbig];
X=[small_yellow small_red small_black big_yellow big_red big_black]';
[p table stats terms]=anovan(X,{Size Color}, 'model','interaction', ...
'varnames',{'Size' 'Color'});
multcompare(stats,'dimension', [1 2])