bone=[...
    1  47.8 48.8 49.0 49.7
2  46.4 47.3 47.7 48.4
3  46.3 46.8 47.8 48.5
4  45.1 45.3 46.1 47.2
5  47.6 48.5 48.9 49.3
6  52.5 53.2 53.3 53.7
7  51.2 53.0 54.3 54.4
8  49.8 50.0 50.3 52.7
9  48.1 50.8 52.3 54.4
10 45.0 47.0 47.3 48.3
11 51.2 51.4 51.6 51.9
12 48.5 49.2 53.0 55.5
13 52.1 52.8 53.7 55.0
14 48.2 48.9 49.3 49.8
15 49.6 50.4 51.2 51.8
16 50.7 51.7 52.7 53.3
17 47.2 47.7 48.4 49.5
18 53.3 54.6 55.1 55.3
19 46.2 47.5 48.1 48.4
20 46.3 47.6 51.3 51.8];
bone=bone(:,2:end);
[n,p]=size(bone);
I1=eye(n);
j1=ones(n,1);
ybar1=(1/n)*bone'*j1
J1=ones(size(I1));
S1=(1/(n-1))*bone'*(I1-(1/n) *J1)*bone
age=[8 8.5 9 9.5];
axis([7 10 40 60])
hold on
for i = 1:n
plot(age,bone(i:i,:),':')
end
plot(age,ybar1,'.-')
title('Ramus Bone length at Four Ages for 20 Boys')
ylabel('Bone Length')
xlabel('Age')
hold off
print 'D:\Profiles\calvinw\work\MthSc807\ramusplot.eps' -deps
% Matrix for a flat profile
C=[1 -1 0 0;
   0 1 -1 0;
   0 0 1 -1
   ];
T2=n1*(C*ybar1)'*inv(C*S1*C')*(C*ybar1)
f=(n+p)*T2/((n-1)*p)
pvalue=1-fcdf(f,p,n+p)

