%LMcs110401_4th.m
% Larsen & Marx (2006) Introduction to Mathematical Statistics, 4th edition
% Page 712
% Written by Eugene.Gallagher@umb.edu Nov 2010, revised 1/20/11
X=[49 8 26 6 46 28 80 68 53 49 65 58 16 14 60 5 10 11 9 68 64 79 11 9 4 ...
 10 21 9 30 69 71 12 76 60 5 24 9 53 70 68 60 5 12 48 4 68 65 49 17 9 12]';
Y=[911 1011 939 935 895 969 898 892 849 879 844 881 969 1024 876 1080 ...
 1044 997 1011 883 908 901 1009 1057 1013 1017 986 1025 913 924 893 ...
 1003 888 860 1056 966 1019 927 879 882 838 1031 1023 886 1067 899 ...
 893 922 921 1044 980]';
plot(X,Y,'ok');xlabel('Rate','FontSize',16);
ylabel('Score','FontSize',16), title('Figure 11.4.1','FontSize',20)
lsline
axis([-10 83 780 1110])
figure(gcf)
corrcoef(X,Y)
[r,c]=size(X)
[B,BINT,R,RINT,STATS] = regress(Y,[ones(r,1) X]);
fprintf('\nThe R^2 = %5.1f%%\n',STATS(1)*100)