% LMFig070402_4th.m
% Page 427 in Larsen & Marx, 2nd ed, page 479 in 4th edition
% Larsen & Marx (2006) Introduction to Mathematical Statistics, 4th edition
% Pots of the z & t distribution.
% E. Gallagher, Eugene.Gallagher@umb.edu
% Revised: 2/5/04
% Plot the normal probability pdf:
% The normal probability equation is provided on p. 264 & 402 in L&M
clf
muj=0;
sigmaj=1; % sigmaj is the standard deviation; 1 for a standardnormal
xmax=4.2;
y=linspace(-xmax,xmax,100);
fyj=tpdf(y,3);
r95=tinv(0.95,3);
% Plot using ax1 handle, saved above,to save this graph
% on top of the previous graph.
h1=line(y,fyj,'Color','r','Linewidth',3);
set(h1,'linestyle','--','color','r','linewidth',3)
axis([-xmax xmax 0 0.41]);
ax1=gca;
set(ax1,'Xtick',[0 r95],'XColor','k','FontSize',18);
set(ax1,'Ytick',0:.2:.4,'FontSize',18);
title('Figure 7.4.2','Fontsize',22);
hold on
plot([0 0]',[0 .405]','k','Linewidth',3)
% add labels
labs=['f_T_3(t)  '];
text(r95,0.075,'Area=alpha','Fontsize',18)
text(0.2,0.37,'f_T_3(t)','Fontsize',18)
xf=r95:0.01:xmax;
yf=tpdf(xf,3);
fill([r95 xf xmax]',[0 yf 0]',[.8 .8 1])
figure(gcf);pause
hold off;
