% LMex040312_4th.m
% Example 4.3.12 Pages 314 in
% Larsen & Marx (2006) Introduction to Mathematical Statistics, 4th edition
% Based on LMex040306_4th.m
% Written Fall 2010 by Eugene Gallagher for EEOS601 Revised: 1/8/11
% Eugene.Gallagher@umb.edu 
% http://alpha.es.umb.edu/faculty/edg/files/edgwebp.html
% An application of propagation of error
% Y=random sample of size 9 from a normal distribution with:
EY=2;
SigmaY=2;
nY=9;
% Ystar=independent random sample of size 4 from a normal distribution with
EYstar=1;
SigmaYstar=1;
nYstar=4;
% Find Probability mean(Y)>=mean(Ystar)
E_YminusYstar=EY-EYstar;
% Var_YminusYstar= VarY+VarYstar
format rat
Var_YminusYstar=SigmaY^2/nY+SigmaYstar^2/nYstar
format
P=1-normcdf((0-E_YminusYstar)/sqrt(Var_YminusYstar));   
fprintf('The probability that Y >= Ystar = %6.4f\n',P)