% LMcs090401_4th.m
% Application of 2-sample binomial test, Theorem 9.4.1 in
% Larsen & Marx (2006) Introduction to Mathematical Statistics, 4th edition
% Written by Eugene.Gallagher@umb.edu
% Calls Gallagher's binom2sample.m
% Written Nov. 2010, revised 12/12/2010, 2/27/2011
[D,phat,z,pvalue,CI,obsp]=binom2sample(1033,1675,344,660,0.05);
fprintf('The expected joint probability is %6.4f\n',phat)
fprintf('The z statistic is %6.4f with two-tailed p = %6.4g\n',z,pvalue)
fprintf('The observed proportions were %6.4f and %6.4f\n',obsp)
fprintf(...
'The difference in proportions is %6.4f with confidence interval: %6.4f %6.4f\n',D,CI)