p192 8.22
X=[85,80,90,88,87,94,56,62,55,48,92,99,95,91,75,72,81];
group=[ones(1,3),2*ones(1,4),3*ones(1,2),4*ones(1,2),5*ones(1,4),6*ones(1,3)];
anova1(X,group);
按计算公式计算得
close all;clear all;clc
x1=[87,85,80];
x2=[90,88,87,94];
x3=[56,62];
x4=[55,48];
x5=[92,99,95,91];
x6=[75,72,81];
X=[x1,x2,x3,x4,x5,x6];
ni=[length(x1),length(x2),length(x3),length(x4),length(x5),length(x6)];
% length(X)
ti=[sum(x1),sum(x2),sum(x3),sum(x4),sum(x5),sum(x6)]; q1=sum(ti);
a=6;n=length(X);
q2=sum(X.^2);
st=q2-q1^2/n;
sa=sum(ti.^2./ni)-q1^2/n;
se=st-sa;