% eda12_06
% A few exemplary calulations of probability

% Z distribution, two-sided test
Z=0.278;
P=normcdf(Z,0,1)-normcdf(-Z,0,1);
disp(sprintf('Z distribution, two sided test:'));
disp(sprintf('  The probability that Z is inside the interval %f to %f',-Z, Z));
disp(sprintf('    is %f',P));
disp(sprintf('  The probability that Z is outside the interval %f to %f',-Z, Z));
disp(sprintf('    is %f',1-P));

% Chi-squared distribution, one-sided test
X2=21.9;
N=25;
P=chi2cdf(X2,N);
disp(sprintf('Chi-squared distribution with %d degrees of freedom:',N));
disp(sprintf('   The Probability that X2 is inside the interval 0 to %f',X2));
disp(sprintf('     is %f', P));
disp(sprintf('   The Probability that X2 is outside the interval 0 to %f',X2));
disp(sprintf('     is %f', 1-P));