% LMcs140304_4th.m
% Larsen & Marx (2006) Introduction to Mathematical Statistics, 4th edition
% Written by Eugene.Gallagher@umb.edu; written 11/16/10; revised 11/23/10
% Calls Matlab's ranksum.m and Gallagher's Wilcoxranksum.m
AL=[177 177 165 172 172 179 163 175 166 182 177 168 179 177]';
NL=[166 154 159 168 174 174 177 167 165 161 164 161]';
boxplot([AL;NL],[ones(length(AL),1);zeros(length(NL),1)],'labels',{'American','National'});
figure(gcf);pause
[P,H,STATS] = ranksum(AL,NL,'alpha',0.05,'method','approximate');
fprintf(...
    '\n\nUsing Matlab''s ranksum, approximate p=%6.4f, Rank sum = %4.1f\n',P,...
    STATS.ranksum)
if H==1
    fprintf('Reject Ho\n\n')
else
    fprintf('Fail to reject Ho\n\n')
end
[P,H,STATS] = ranksum(AL,NL,'alpha',0.05,'method','exact');
fprintf(...
    '\n\nUsing Matlab''s ranksum, exact p=%6.4f, Rank sum = %4.1f\n',P,...
    STATS.ranksum)
if H==1
    fprintf('Reject Ho\n\n')
else
    fprintf('Fail to reject Ho\n\n')
end
