Chapter 2: gaussian sampling-likelihood surface
Chapter 2: gaussian sampling-likelihood surface
To generate the sampling-likelihood surface and the sliced sampling and likelihood plots (Fig. 2.7), we need to first compute a large set of probabilities for combinations of average datum (x-bar) and location parameter (mu), allowing us to plot the 2D surface. Then we select one average datum (corresponding to experimental observations) and compute the likelihood (taking a slice through the surface at the experimental observation). Similarly, we select one hypothetical location parameter (corresponding to the frequentist ‘null hypothesis’) and compute the sampling distribution (taking a slice through the surface at the null hypothesis).
up=.0017; dv=1; BR=-.75; %BRighten + or darken - the mesh
H0=50; murange=[15 85]; sig=10;
DatVals=45;
if length(DatVals)>1, sig=sqrt(var(DatVals,1)); Xbar=mean(DatVals); else Xbar=DatVals; end
while murange(2)/dv>60, dv=dv+1; end
N=round(murange(2)/dv);
figure(1); clf; hold on
x=linspace(murange(1),murange(2),N);
[X Y]=meshgrid(x,x); GA=[];
for n=1:length(x),
GA(:,n)=npdf(x,x(n),sig); end
mesh(X,Y,GA); colormap(bone); brighten(BR); view(-36,58);
r=axis; axis([murange murange 0 r(end)])
GA=npdf(x,H0,sig);
plot3(ones(size(x))*H0,x,zeros(size(x)),'k-','LineWidth',.9)
for n=length(x):-1:1, plot3(H0,x(n),GA(n)+up,'ko','MarkerFaceColor','w','MarkerSize',8,'LineWidth',.9), end
%plot3(ones(size(x))*H0,x,GA+up,'ko','MarkerFaceColor','w','MarkerSize',8,'LineWidth',.8)
figure(2); clf; hold on %stem(x,GA,'ko','MarkerFaceColor','w','MarkerSize',8,'LineWidth',.8)
GAi=interp1(x,GA,[x(1):1/(length(x)*5):x(end)],'pchip');
plot([x(1):1/(length(x)*5):x(end)],GAi,'k-','LineWidth',.9)
plot(x,GA,'ko','MarkerFaceColor','w','MarkerSize',8,'LineWidth',1.5)
GAt=interp1(x,GA,H0,'pchip');
plot(H0*[1 1],[0 GAt],'k-','LineWidth',1.3)
plot(H0,GAt,'ko','MarkerFaceColor','w','MarkerSize',8,'LineWidth',1.5)
GAt=interp1(x,GA,Xbar,'pchip');
plot(Xbar*[1 1],[0 GAt],'k--','LineWidth',1.3)
plot(Xbar,GAt,'ko','MarkerFaceColor','k','MarkerSize',8,'LineWidth',1.5)
r=axis; axis([murange 0 r(end)*1.05])
figure(1); GA=npdf(Xbar,x,sig);
plot3(x,ones(size(x))*Xbar,GA+up,'ko','MarkerFaceColor','k','MarkerSize',8,'LineWidth',.8)
plot3(x,ones(size(x))*Xbar,zeros(size(x)),'k-','LineWidth',.9)
figure(3); clf; hold on %stem(x,GA,'ko','MarkerFaceColor','k','MarkerSize',8,'LineWidth',.8)
GAi=interp1(x,GA,[x(1):1/(length(x)*5):x(end)]);
plot([x(1):1/(length(x)*5):x(end)],GAi,'k-','LineWidth',.9)
plot(x,GA,'ko','MarkerFaceColor','k','MarkerSize',8,'LineWidth',1.5)
GAt=interp1(x,GA,H0,'pchip');
plot(H0*[1 1],[0 GAt],'k--','LineWidth',1.3)
plot(H0,GAt,'ko','MarkerFaceColor','w','MarkerSize',8,'LineWidth',1.5)
GAt=interp1(x,GA,Xbar,'pchip');
plot(Xbar*[1 1],[0 GAt],'k-','LineWidth',1.3)
plot(Xbar,GAt,'ko','MarkerFaceColor','k','MarkerSize',8,'LineWidth',1.5)
r=axis; axis([murange 0 r(end)*1.05])