%exercice 2 clear all; close all; g1={'p1','p1','p3','p1','p2','p1','p2','p2','p2','p3','p3','p3'}; g2={'c1','c1','c1','c2','c1','c2','c2','c1','c2','c1','c2','c2'}; g3={'e2','e1','e1','e2','e2','e1','e1','e1','e2','e2','e1','e2'}; varnames={'phare','calandre','entree air'}; % S=[6 4 3 7 6.5 4 4 3 6 6 5 7]; S=[2 8 8.5 9 1.8 1 1.2 9.5 8.1 1.0 1.3 9.1]; %Anova sans intéraction [p,tbl1,stats1,terms1]=anovan(S,{g1 g2 g3},'model','linear','varnames',varnames); Rsquared=1-cell2mat(tbl1(size(tbl1,1)-1,2))/cell2mat(tbl1(size(tbl1,1),2)) % coeffficients du modèle for i=1:length(stats1.coeffs) disp([cell2mat(stats1.coeffnames(i)),' : ',num2str(stats1.coeffs(i))]); end %avec interactions completes [p,tbl1,stats1,terms1]=anovan(S,{g1 g2 g3},'model','interaction','sstype',3,'varnames',varnames); % coefficient de détermination R2 Rsquared=1-cell2mat(tbl1(size(tbl1,1)-1,2))/cell2mat(tbl1(size(tbl1,1),2)) % coeffficients du modèle for i=1:length(stats1.coeffs) disp([cell2mat(stats1.coeffnames(i)),' : ',num2str(stats1.coeffs(i))]); end % %sans g1, avec interactions completes % varnames={'calandre','entree air'}; % [p,tbl1,stats1,terms1]=anovan(S,{g1 g2},'model','interaction','sstype',3,'varnames',varnames); % % coefficient de détermination R2 % Rsquared=1-cell2mat(tbl1(size(tbl1,1)-1,2))/cell2mat(tbl1(size(tbl1,1),2)) % % coeffficients du modèle % for i=1:length(stats1.coeffs) % disp([cell2mat(stats1.coeffnames(i)),' : ',num2str(stats1.coeffs(i))]); % end