function Lambda=Wilks(X1,X2,X3)

[n1,p1]=size(X1); [n2,p1]=size(X2); [n3,p1]=size(X3);

n = n1+n2+n3;
m1 = mean(X1); m2 = mean(X2); m3 = mean(X3);
S1 = cov(X1);  S2 = cov(X2);  S3 = cov(X3);

W = (n1-1)*S1+ (n2-1)*S2+ (n3-1)*S3;
m = mean([X1;X2;X3]);           

B1 = (m1-m)'*(m1-m); B2 = (m2-m)'*(m2-m); B3 = (m3-m)'*(m3-m);
B = n1*B1+ n2*B2+ n3*B3;

Lambda = det(W)/det(B+W);

