% LMcs090202_4th.m
% Table 9.2.2 & Table 9.2.3 data
% Larsen &  arx (2006) Introduction to Mathematical Statistics, 4th edition
% Page 560-562. Case Study 9.2.2, 2-sample t-test using grouped data
% Written by Eugene.Gallagher@umb.edu
% http://alpha.es.umb.edu/faculty/edg/files/edgwebp.html
% Written & last revised 11/17/2010
Xn=229;Xmean=2.14;Xstd=0.94;Yn=243;Ymean=4.21;Ystd=0.83;alpha=0.05;
[D,t,df,pvalue,CI,sp]=student2group(Xn,Yn,Xmean,Ymean,Xstd,Ystd,alpha);
fprintf('The Student''s t statistic was %6.4f with %3.0f df.\n',t,df)
fprintf('The pooled standard deviation was %6.4f\n',sp)
fprintf('The 1-tailed p for enthusiasm =%6.2g\n',pvalue/2);
fprintf('The difference is %4.3f with 95%% CI = [%5.3f %5.3f]\n',D, ...
    CI(1),CI(2));
% Table 9.2.3 data
Xn=229;Xmean=3.61;Xstd=0.84;Yn=243;Ymean=4.05;Ystd=0.95;alpha=0.05;
[D,t,df,pvalue,CI,sp]=student2group(Xn,Yn,Xmean,Ymean,Xstd,Ystd,alpha);
fprintf('The Student''s t statistic was %6.4f with %3.0f df.\n',t,df)
fprintf('The pooled standard deviation was %6.4f\n',sp)
fprintf('The 1-tailed p for knowledgeable =%6.2g\n',pvalue/2);
fprintf('The difference is %4.3f with 95%% CI = [%5.3f %5.3f]\n',D, ...
    CI(1),CI(2));