% data point inside of 3D box with 1:1:1 refernce line
axis( [xmin, xmax, ymin, ymax, zmin, zmax]');
[XX, YY, ZZ] = meshgrid( x, y, z );
% the point is at a randomly chosen point in d-space
% using a Normal distribution with specified mean and variance
rbar = random('Normal',2.5,0.5,3,1);
% visualize the point in 3D using an isosurface of a normal distribution
norm = ( ((2*pi)^(3/2)) * sqrt(DC) );
r = [XX(i,j,k), YY(i,j,k), ZZ(i,j,k)]';
PP(i,j,k) = exp(-0.5*(r-rbar)'*CI*(r-rbar))/norm;
axis( [xmin, xmax, ymin, ymax, zmin, zmax]');
plot3( [xmin,xmin], [ymin,ymin], [zmin,zmax], 'k-', 'LineWidth', 2 );
plot3( [xmin,xmin], [ymin,ymax], [zmin,zmin], 'k-', 'LineWidth', 2 );
plot3( [xmin,xmax], [ymin,ymin], [zmin,zmin], 'k-', 'LineWidth', 2 );
plot3( [xmax,xmax], [ymax,ymax], [zmax,zmin], 'k-', 'LineWidth', 2 );
plot3( [xmax,xmax], [ymax,ymin], [zmax,zmax], 'k-', 'LineWidth', 2 );
plot3( [xmax,xmin], [ymax,ymax], [zmax,zmax], 'k-', 'LineWidth', 2 );
plot3( [xmax,xmin], [ymin,ymin], [zmax,zmax], 'k-', 'LineWidth', 2 );
plot3( [xmax,xmax], [ymin,ymin], [zmax,zmin], 'k-', 'LineWidth', 2 );
plot3( [xmin,xmin], [ymax,ymin], [zmax,zmax], 'k-', 'LineWidth', 2 );
plot3( [xmin,xmin], [ymax,ymax], [zmax,zmin], 'k-', 'LineWidth', 2 );
plot3( [xmax,xmax], [ymax,ymin], [zmin,zmin], 'k-', 'LineWidth', 2 );
plot3( [xmax,xmin], [ymax,ymax], [zmin,zmin], 'k-', 'LineWidth', 2 );
plot3( [0, 5], [0, 5], [0, 5], 'b-', 'LineWidth', 3 );
% plot isosurface to show point in 3-space
p=patch(isosurface( XX, YY, ZZ, PP, 0.9*maxP ));
isonormals(XX,YY,ZZ,PP,p)
set(p, 'FaceColor', 'black', 'EdgeColor', 'none');
% set view direction & lighting
fprintf('Caption: Data point [d1,d2,d3] (circle) near the d2=d2=d3 line(blue)\n');
Caption: Data point [d1,d2,d3] (circle) near the d2=d2=d3 line(blue)
% isosurfaace of a 3D Normal distribution
[XX, YY, ZZ] = meshgrid( x, y, z );
% parameters for Normal distribution
norm = ( ((2*pi)^(3/2)) * sqrt(DC) );
% normal distribution in 3D space
r = [XX(i,j,k), YY(i,j,k), ZZ(i,j,k)]';
PP(i,j,k) = exp(-0.5*(r-rbar)'*CI*(r-rbar))/norm;
% A = Dx*Dx*Dz*sum(sum(sum(PP)));
% max, for plotting purposes
axis( [xmin, xmax, ymin, ymax, zmin, zmax]');
plot3( [xmin,xmin], [ymin,ymin], [zmin,zmax], 'k-', 'LineWidth', 2 );
plot3( [xmin,xmin], [ymin,ymax], [zmin,zmin], 'k-', 'LineWidth', 2 );
plot3( [xmin,xmax], [ymin,ymin], [zmin,zmin], 'k-', 'LineWidth', 2 );
plot3( [xmax,xmax], [ymax,ymax], [zmax,zmin], 'k-', 'LineWidth', 2 );
plot3( [xmax,xmax], [ymax,ymin], [zmax,zmax], 'k-', 'LineWidth', 2 );
plot3( [xmax,xmin], [ymax,ymax], [zmax,zmax], 'k-', 'LineWidth', 2 );
plot3( [xmax,xmin], [ymin,ymin], [zmax,zmax], 'k-', 'LineWidth', 2 );
plot3( [xmax,xmax], [ymin,ymin], [zmax,zmin], 'k-', 'LineWidth', 2 );
plot3( [xmin,xmin], [ymax,ymin], [zmax,zmax], 'k-', 'LineWidth', 2 );
plot3( [xmin,xmin], [ymax,ymax], [zmax,zmin], 'k-', 'LineWidth', 2 );
plot3( [xmax,xmax], [ymax,ymin], [zmin,zmin], 'k-', 'LineWidth', 2 );
plot3( [xmax,xmin], [ymax,ymax], [zmin,zmin], 'k-', 'LineWidth', 2 );
plot3( [0, 5], [0, 5], [0, 5], 'b-', 'LineWidth', 3 );
% draw speherical cloud in 3D space
p(ip)=patch(isosurface( XX, YY, ZZ, PP, ip*maxP/10 ));
isonormals(XX,YY,ZZ,PP, p(ip))
set(p(ip), 'FaceColor', 'red', 'FaceAlpha', ip/20, 'EdgeColor', 'none');
% set view angle and lighting
fprintf('Caption: Depiction of Normal pdf (red) centered on d1=d2=d3 line\n');
Caption: Depiction of Normal pdf (red) centered on d1=d2=d3 line
% Likelihood surface for mean/variance
d = random('Normal',2.5,1.5,N,1);
% s-axis, with s=sqrt(variance)
% tabulate likelihood surface
% Normal P = (1/sqrt(2pi)) * (1/s) * exp( -0.5 (d-m)^2 / s^2 )
% L = -0.5log(2*pi) - log(s) - ( -0.5 (d-m)^2 / s^2 )
L(i,j) = -N*log(2*pi)/2 - N*log(sp) - 0.5*sum((d-mp).^2)/(sp^2);
% find (i,j) of point of maximum
% maximum likelihood point
fprintf('mean %f sigma %f\n',mbest,sbest);
mean 2.410000 sigma 1.640000
% ninimum for plotting purposes
axis( [pmmin, pmmax, psmin, psmax, pLmin, pLmax]');
% clip parts of grid by setting L to NaN
pxmin=pmmin+0.01; pxmax=pmmax-0.01;
pymin=psmin+0.01; pymax=psmax-0.01;
pzmin=pLmin+1; pzmax=pLmax-1;
% improvise 3D box on the plot
plot3( [pxmin,pxmin], [pymin,pymin], [pzmin,pzmax], 'k-', 'LineWidth', 2 );
plot3( [pxmin,pxmin], [pymin,pymax], [pzmin,pzmin], 'k-', 'LineWidth', 2 );
plot3( [pxmin,pxmax], [pymin,pymin], [pzmin,pzmin], 'k-', 'LineWidth', 2 );
plot3( [pxmax,pxmax], [pymax,pymax], [pzmax,pzmin], 'k-', 'LineWidth', 2 );
plot3( [pxmax,pxmax], [pymax,pymin], [pzmax,pzmax], 'k-', 'LineWidth', 2 );
plot3( [pxmax,pxmin], [pymax,pymax], [pzmax,pzmax], 'k-', 'LineWidth', 2 );
plot3( [pxmax,pxmin], [pymin,pymin], [pzmax,pzmax], 'k-', 'LineWidth', 2 );
plot3( [pxmax,pxmax], [pymin,pymin], [pzmax,pzmin], 'k-', 'LineWidth', 2 );
plot3( [pxmin,pxmin], [pymax,pymin], [pzmax,pzmax], 'k-', 'LineWidth', 2 );
plot3( [pxmin,pxmin], [pymax,pymax], [pzmax,pzmin], 'k-', 'LineWidth', 2 );
plot3( [pxmax,pxmax], [pymax,pymin], [pzmin,pzmin], 'k-', 'LineWidth', 2 );
plot3( [pxmax,pxmin], [pymax,pymax], [pzmin,pzmin], 'k-', 'LineWidth', 2 );
plot3( [mbest, mbest], [sbest, sbest], [Lmax-DL, Lmax+DL], 'r-', 'LineWidth', 4 );
plot3( [mbest-0.1, mbest+0.1], [sbest, sbest], [Lmax, Lmax], 'r-', 'LineWidth', 4 );
plot3( [mbest, mbest], [sbest-0.1, sbest+0.1], [Lmax, Lmax], 'r-', 'LineWidth', 4 );
fprintf('Caption; Depiction of likelihood surfaceL(mean,sigma)\n');
Caption; Depiction of likelihood surfaceL(mean,sigma)
fprintf('with estimated model (red) superimposed\n');
with estimated model (red) superimposed
% examples of probability density function p(d1,d2)
% one is peaked, the other had a ridge
Dd1 = (d1max-d1min)/(Nd1-1);
d1 = d1min + Dd1*[0:Nd1-1]';
Dd2 = (d2max-d2min)/(Nd2-1);
d2 = d2min + Dd2*[0:Nd2-1]';
% distribution 1, has a peak
norm = (1/(2*pi)) * (1/sqrt(DC));
d =[X(i,j), Y(i,j)]' - dbar;
P1(i,j) = norm*exp( -0.5 * d'*CI* d );
% A = Dd1*Dd2*sum(sum(P1)
% Note distribution not normalizable
dr =[X(i,j)-d0a(1), Y(i,j)-d0a(2)]';
P2(i,j) = 0.2*exp(-0.5*r2/sda);
pxmin=d1min; pxmax=d1max;
pymin=d2min; pymax=d2max;
axis( [pxmin-0.01, pxmax+0.01, pymin-0.01, pymax+0.01, pzmin-0.01, pzmax+0.01 ]' );
plot3( [pxmin,pxmin], [pymin,pymin], [pzmin,pzmax], 'k-', 'LineWidth', 2 );
plot3( [pxmin,pxmin], [pymin,pymax], [pzmin,pzmin], 'k-', 'LineWidth', 2 );
plot3( [pxmin,pxmax], [pymin,pymin], [pzmin,pzmin], 'k-', 'LineWidth', 2 );
plot3( [pxmax,pxmax], [pymax,pymax], [pzmax,pzmin], 'k-', 'LineWidth', 2 );
plot3( [pxmax,pxmax], [pymax,pymin], [pzmax,pzmax], 'k-', 'LineWidth', 2 );
plot3( [pxmax,pxmin], [pymax,pymax], [pzmax,pzmax], 'k-', 'LineWidth', 2 );
plot3( [pxmax,pxmin], [pymin,pymin], [pzmax,pzmax], 'k-', 'LineWidth', 2 );
plot3( [pxmax,pxmax], [pymin,pymin], [pzmax,pzmin], 'k-', 'LineWidth', 2 );
plot3( [pxmin,pxmin], [pymax,pymin], [pzmax,pzmax], 'k-', 'LineWidth', 2 );
plot3( [pxmin,pxmin], [pymax,pymax], [pzmax,pzmin], 'k-', 'LineWidth', 2 );
plot3( [pxmax,pxmax], [pymax,pymin], [pzmin,pzmin], 'k-', 'LineWidth', 2 );
plot3( [pxmax,pxmin], [pymax,pymax], [pzmin,pzmin], 'k-', 'LineWidth', 2 );
axis( [pxmin-0.01, pxmax+0.01, pymin-0.01, pymax+0.01, pzmin-0.01, pzmax+0.01 ]' );
plot3( [pxmin,pxmin], [pymin,pymin], [pzmin,pzmax], 'k-', 'LineWidth', 2 );
plot3( [pxmin,pxmin], [pymin,pymax], [pzmin,pzmin], 'k-', 'LineWidth', 2 );
plot3( [pxmin,pxmax], [pymin,pymin], [pzmin,pzmin], 'k-', 'LineWidth', 2 );
plot3( [pxmax,pxmax], [pymax,pymax], [pzmax,pzmin], 'k-', 'LineWidth', 2 );
plot3( [pxmax,pxmax], [pymax,pymin], [pzmax,pzmax], 'k-', 'LineWidth', 2 );
plot3( [pxmax,pxmin], [pymax,pymax], [pzmax,pzmax], 'k-', 'LineWidth', 2 );
plot3( [pxmax,pxmin], [pymin,pymin], [pzmax,pzmax], 'k-', 'LineWidth', 2 );
plot3( [pxmax,pxmax], [pymin,pymin], [pzmax,pzmin], 'k-', 'LineWidth', 2 );
plot3( [pxmin,pxmin], [pymax,pymin], [pzmax,pzmax], 'k-', 'LineWidth', 2 );
plot3( [pxmin,pxmin], [pymax,pymax], [pzmax,pzmin], 'k-', 'LineWidth', 2 );
plot3( [pxmax,pxmax], [pymax,pymin], [pzmin,pzmin], 'k-', 'LineWidth', 2 );
plot3( [pxmax,pxmin], [pymax,pymax], [pzmin,pzmin], 'k-', 'LineWidth', 2 );
fprintf('Caption: (left) Pdf p(x1,x2) with a peak. (right) Pdf\n');
Caption: (left) Pdf p(x1,x2) with a peak. (right) Pdf
fprintf('p(x1,x2) with a ridge.\n');
% relative entropy of onenormsl pdf p(m)
% with respect to another q(m)
p = (1 /(sqrt(2*pi)*sigmamp))*exp(-((m-mbarp).^2)/(2*sigmamp*sigmamp));
q = (1 /(sqrt(2*pi)*sigmamq))*exp(-((m-mbarq).^2)/(2*sigmamq*sigmamq));
axis( [mmin, mmax, 0, max(p)] );
plot( m, p, 'r-', 'LineWidth', 3);
plot( m, q, 'g-', 'LineWidth', 3);
fprintf('Caption: Two Normal pdfs p(m) (red) and q(m) (green)\n');
Caption: Two Normal pdfs p(m) (red) and q(m) (green)
r = (sigmamp^2)/(sigmamq^2);
Sanalytic = ((mbarp-mbarq)^2)/(2*sigmamq*sigmamq) + 0.5*(r-1-log(r));
Snumeric = Dm*sum( p .* log( p ./ q ) );
fprintf('S = %f (analytic) and %f (numeric)\n', Sanalytic, Snumeric );
S = 1.129438 (analytic) and 1.129438 (numeric)
% relative entropy as a function of sigmamp
sigmampv = sigmamq*[1:Nv]'/Nv;
rv = (sigmampv.^2)/(sigmamq^2);
Sv = ((mbarp-mbarq)^2)./(2*sigmamq*sigmamq) + 0.5*(rv-1-log(rv));
axis( [0, sigmamq, 0, max(Sv)] );
plot( sigmampv, Sv, 'k-', 'LineWidth', 3);
plot( sigmamp, Sanalytic, 'ro', 'LineWidth', 3);
fprintf('Caption: Relative entropy of p(m) and q(m) as the\n');
Caption: Relative entropy of p(m) and q(m) as the
fprintf('as the sigma of p id varied. One point on curve (red circle)\n');
as the sigma of p id varied. One point on curve (red circle)
fprintf('determined by an analytic method\n');
determined by an analytic method
% parameteric function passing thru distribution p(d1,m1)
Dd1 = (d1max-d1min)/(Nd1-1);
d1 = d1min + Dd1*[0:Nd1-1]';
Dm1 = (m1max-m1min)/(Nm1-1);
m1 = m1min + Dm1*[0:Nm1-1]';
C1 = diag( [sd1^2, sm1^2]' );
norm1 = (1/(2*pi)) * (1/sqrt(DC1));
x1 =[d1(i), m1(j)]' - bar;
P1(i,j) = norm1*exp( -0.5 * x1'*CI1*x1 );
% s-axis for parametric curve
ipd = 1+floor((dp-d1min)/Dd1);
ipm = 1+floor((mp-m1min)/Dm1);
% insure indices in range
Ps(i) = P1(ipd(i), ipm(i));
% plot p(d1,m1) with parametric curve crossing it
axis( [d1min, d1max, m1min, m1max] );
imagesc( [d1min, d1max], [m1min, m1max], P1 );
plot( m1bar, d1bar, 'wo', 'LineWidth', 3 );
plot( [m1bar, m1bar], [d1max, d1max-0.1], 'w-', 'LineWidth', 3 );
plot( [m1min, m1min+0.1], [d1bar, d1bar], 'w-', 'LineWidth', 3 );
plot( mp, dp, 'w-', 'LineWidth', 3 );
plot( m1smax, d1smax, 'ko', 'LineWidth', 4);
plot( [m1min, m1smax], [d1smax, d1smax], 'w:', 'LineWidth', 2);
plot( [m1smax, m1smax], [d1max, d1smax], 'w:', 'LineWidth', 2);
fprintf('Caption: Probability density function p(d,m) (colors) with parametric curve\n');
Caption: Probability density function p(d,m) (colors) with parametric curve
fprintf('f(d,m)=0 (white) superimposed. The point of mximum probability\n');
f(d,m)=0 (white) superimposed. The point of mximum probability
fprintf('along the curve is shown with a black circle\n');
along the curve is shown with a black circle
% plot distribution as a function of arclength along curve
axis( [smin, smax, 0, 0.3] );
plot( s, Ps, 'b-', 'Linewidth', 3 );
fprintf('Caption: Probability as a function of arc-length along the parametric curve.\n');
Caption: Probability as a function of arc-length along the parametric curve.
fprintf('The probability has a single maximum\n');
The probability has a single maximum
% parameteric function passing thru distribution p(d1,m2)
Dd1 = (d1max-d1min)/(Nd1-1);
d1 = d1min + Dd1*[0:Nd1-1]';
Dm1 = (m1max-m1min)/(Nm1-1);
m1 = m1min + Dm1*[0:Nm1-1]';
C1 = diag( [sd1^2, sm1^2]' );
norm1 = (1/(2*pi)) * (1/sqrt(DC1));
x1 =[d1(i), m1(j)]' - bar;
P1(i,j) = norm1*exp( -0.5 * x1'*CI1*x1 );
% s-axis for parametric curve
ipd = 1+floor((dp-d1min)/Dd1);
ipm = 1+floor((mp-m1min)/Dm1);
% insure indices in range
Ps(i) = P1(ipd(i), ipm(i));
% plot distribution with parameteric curve superimposed
axis( [d1min, d1max, m1min, m1max] );
imagesc( [d1min, d1max], [m1min, m1max], P1 );
plot( m1bar, d1bar, 'wo', 'LineWidth', 3 );
plot( [m1bar, m1bar], [d1max, d1max-0.1], 'w-', 'LineWidth', 3 );
plot( [m1min, m1min+0.1], [d1bar, d1bar], 'w-', 'LineWidth', 3 );
plot( mp, dp, 'w-', 'LineWidth', 3 );
plot( m1smax, d1smax, 'ko', 'LineWidth', 4);
plot( [m1min, m1smax], [d1smax, d1smax], 'w:', 'LineWidth', 2);
plot( [m1smax, m1smax], [d1max, d1smax], 'w:', 'LineWidth', 2);
fprintf('Caption: Probability density function p(d,m) (colors) with parametric curve\n');
Caption: Probability density function p(d,m) (colors) with parametric curve
fprintf('f(d,m)=0 (white) superimposed. In this case the prior model is very certain\n');
f(d,m)=0 (white) superimposed. In this case the prior model is very certain
fprintf('The point of mximum probability along the curve is shown with a black circle.\n');
The point of mximum probability along the curve is shown with a black circle.
% plot distribution as a function of arc-length along curve
axis( [smin, smax, 0, 1] );
plot( s, Ps, 'b-', 'Linewidth', 3 );
fprintf('Caption: Probability as a function of arc-length along the parametric curve.\n');
Caption: Probability as a function of arc-length along the parametric curve.
fprintf('The probability has a single maximum\n');
The probability has a single maximum
% parameteric function passing thru distribution p(d1,m1)
Dd1 = (d1max-d1min)/(Nd1-1);
d1 = d1min + Dd1*[0:Nd1-1]';
Dm1 = (m1max-m1min)/(Nm1-1);
m1 = m1min + Dm1*[0:Nm1-1]';
C1 = diag( [sd1^2, sm1^2]' );
norm1 = (1/(2*pi)) * (1/sqrt(DC1));
x1 =[d1(i), m1(j)]' - bar;
P1(i,j) = norm1*exp( -0.5 * x1'*CI1*x1 );
% axis for parametric curve
ipd = 1+floor((dp-d1min)/Dd1);
ipm = 1+floor((mp-m1min)/Dm1);
% insure indices in range
Ps(i) = P1(ipd(i), ipm(i));
% plot distribution with parameteric curve superimposed
axis( [d1min, d1max, m1min, m1max] );
imagesc( [d1min, d1max], [m1min, m1max], P1 );
plot( m1bar, d1bar, 'wo', 'LineWidth', 3 );
plot( [m1bar, m1bar], [d1max, d1max-0.1], 'w-', 'LineWidth', 3 );
plot( [m1min, m1min+0.1], [d1bar, d1bar], 'w-', 'LineWidth', 3 );
plot( mp, dp, 'w-', 'LineWidth', 3 );
plot( m1smax, d1smax, 'ko', 'LineWidth', 4);
plot( [m1min, m1smax], [d1smax, d1smax], 'w:', 'LineWidth', 2);
plot( [m1smax, m1smax], [d1max, d1smax], 'w:', 'LineWidth', 2);
fprintf('Caption: Probability density function p(d,m) (colors) with parametric curve\n');
Caption: Probability density function p(d,m) (colors) with parametric curve
fprintf('f(d,m)=0 (white) superimposed. In this case the prior model is very uncertain\n');
f(d,m)=0 (white) superimposed. In this case the prior model is very uncertain
fprintf('The point of mximum probability along the curve is shown with a black circle.\n');
The point of mximum probability along the curve is shown with a black circle.
% plot distribution as a function of arc-length along the curve
axis( [smin, smax, 0, 1] );
plot( s, Ps, 'b-', 'Linewidth', 3 );
fprintf('Caption: Probability as a function of arc-length along the parametric curve.\n');
Caption: Probability as a function of arc-length along the parametric curve.
fprintf('The probability has a single maximum\n');
The probability has a single maximum
% prior distribution pA(d1,m1) interacting with inexact
% theory pg(d1,m1) to produce total distribution pT(d1,m1)
Dd1 = (d1max-d1min)/(Nd1-1);
d1 = d1min + Dd1*[0:Nd1-1]';
Dm1 = (m1max-m1min)/(Nm1-1);
m1 = m1min + Dm1*[0:Nm1-1]';
% setup for distribution P1=PA
C1 = diag( [sd1^2, sm1^2]' );
% note not normaalized, so max is unity
x1 =[d1(i), m1(j)]' - bar;
P1(i,j) = exp( -0.5 * x1'*CI1*x1 );
% s-axis for parametric curve s
% Pg follows parameric curve
% P2=Pg distribution; not normalizable
r2 = (d1(i)-dp).^2 + (m1(j)-mp).^2;
P2(i,j) = exp( -r2min/sg2 );
% P3=PT is product of PA and Pg
Pmaxm1 = m1min+Dm1*(Pj-1);
Pmaxd1 = d1min+Dd1*(Pi-1);
axis( [d1min, d1max, m1min, m1max] );
imagesc( [d1min, d1max], [m1min, m1max], P1 );
plot( m1bar, d1bar, 'wo', 'LineWidth', 3 );
plot( [m1bar, m1bar], [d1max, d1max-0.1], 'w-', 'LineWidth', 3 );
plot( [m1min, m1min+0.1], [d1bar, d1bar], 'w-', 'LineWidth', 3 );
plot( mp, dp, 'w:', 'LineWidth', 2 );
axis( [d1min, d1max, m1min, m1max] );
imagesc( [d1min, d1max], [m1min, m1max], P2 );
plot( mp, dp, 'w:', 'LineWidth', 2 );
plot( m1bar, d1bar, 'wo', 'LineWidth', 3 );
plot( [m1bar, m1bar], [d1max, d1max-0.1], 'w-', 'LineWidth', 3 );
plot( [m1min, m1min+0.1], [d1bar, d1bar], 'w-', 'LineWidth', 3 );
axis( [d1min, d1max, m1min, m1max] );
imagesc( [d1min, d1max], [m1min, m1max], P3 );
plot( mp, dp, 'w:', 'LineWidth', 2 );
plot( m1bar, d1bar, 'wo', 'LineWidth', 3 );
plot( Pmaxm1, Pmaxd1, 'ko', 'LineWidth', 3 );
plot( [m1bar, m1bar], [d1max, d1max-0.1], 'w-', 'LineWidth', 3 );
plot( [m1min, m1min+0.1], [d1bar, d1bar], 'w-', 'LineWidth', 3 );
plot( [Pmaxm1, Pmaxm1], [d1max, d1max-0.1], 'k-', 'LineWidth', 3 );
plot( [m1min, m1min+0.1], [Pmaxd1, Pmaxd1], 'k-', 'LineWidth', 3 );
fprintf('Caption: (Left) The prior pdf pA combining observation and prior information\n');
Caption: (Left) The prior pdf pA combining observation and prior information
fprintf('(Middle) the pdf of the theory Pg (right) the combined pdf pT\n');
(Middle) the pdf of the theory Pg (right) the combined pdf pT
% Two different cases of:
% prior distribution pA(d1,m1) interacting with inexact
% theory pg(d1,m1) to produce total distribution pT(d1,m1)
% once case with very exact theory, other with very inexact one
Dd1 = (d1max-d1min)/(Nd1-1);
d1 = d1min + Dd1*[0:Nd1-1]';
Dm1 = (m1max-m1min)/(Nm1-1);
m1 = m1min + Dm1*[0:Nm1-1]';
% Case 1: nearly inexact theory
C1 = diag( [sd1^2, sm1^2]' );
% note not normalized, so max is unity
x1 =[d1(i), m1(j)]' - bar;
P1(i,j) = exp( -0.5 * x1'*CI1*x1 );
% s-axis for parametric curve
% Parametric distribution; not normalizable
r2 = (d1(i)-dp).^2 + (m1(j)-mp).^2;
P2(i,j) = exp( -r2min/sg2 );
Pmaxm1 = m1min+Dm1*(Pj-1);
Pmaxd1 = d1min+Dd1*(Pi-1);
axis( [d1min, d1max, m1min, m1max] );
imagesc( [d1min, d1max], [m1min, m1max], P1 );
plot( m1bar, d1bar, 'wo', 'LineWidth', 3 );
plot( [m1bar, m1bar], [d1max, d1max-0.1], 'w-', 'LineWidth', 3 );
plot( [m1min, m1min+0.1], [d1bar, d1bar], 'w-', 'LineWidth', 3 );
plot( mp, dp, 'w:', 'LineWidth', 2 );
axis( [d1min, d1max, m1min, m1max] );
imagesc( [d1min, d1max], [m1min, m1max], P2 );
plot( mp, dp, 'w:', 'LineWidth', 2 );
plot( m1bar, d1bar, 'wo', 'LineWidth', 3 );
plot( [m1bar, m1bar], [d1max, d1max-0.1], 'w-', 'LineWidth', 3 );
plot( [m1min, m1min+0.1], [d1bar, d1bar], 'w-', 'LineWidth', 3 );
axis( [d1min, d1max, m1min, m1max] );
imagesc( [d1min, d1max], [m1min, m1max], P3 );
plot( mp, dp, 'w:', 'LineWidth', 2 );
plot( m1bar, d1bar, 'wo', 'LineWidth', 3 );
plot( Pmaxm1, Pmaxd1, 'ko', 'LineWidth', 3 );
plot( [m1bar, m1bar], [d1max, d1max-0.1], 'w-', 'LineWidth', 3 );
plot( [m1min, m1min+0.1], [d1bar, d1bar], 'w-', 'LineWidth', 3 );
plot( [Pmaxm1, Pmaxm1], [d1max, d1max-0.1], 'k-', 'LineWidth', 3 );
plot( [m1min, m1min+0.1], [Pmaxd1, Pmaxd1], 'k-', 'LineWidth', 3 );
fprintf('Caption: Prior pdf pA(d1,m1) (left) interacting with\n');
Caption: Prior pdf pA(d1,m1) (left) interacting with
fprintf('inexact theory pg(d1,m1) (middle) to produce total pdf pT(d1,m1)\n');
inexact theory pg(d1,m1) (middle) to produce total pdf pT(d1,m1)
fprintf('(right). In this case, the theory is very exact\n');
(right). In this case, the theory is very exact
% Case 2: exact (narrow) theory
C1 = diag( [sd1^2, sm1^2]' );
% note not normalized, so max is unity
x1 =[d1(i), m1(j)]' - bar;
P1(i,j) = exp( -0.5 * x1'*CI1*x1 );
% s-axis for parametric curve
% Parametric distribution; not normalizable
r2 = (d1(i)-dp).^2 + (m1(j)-mp).^2;
P2(i,j) = exp( -r2min/sg2 );
Pmaxm1 = m1min+Dm1*(Pj-1);
Pmaxd1 = d1min+Dd1*(Pi-1);
set( gcf, 'pos', [10, 10, 800, 300] );
axis( [d1min, d1max, m1min, m1max] );
imagesc( [d1min, d1max], [m1min, m1max], P1 );
plot( m1bar, d1bar, 'wo', 'LineWidth', 3 );
plot( [m1bar, m1bar], [d1max, d1max-0.1], 'w-', 'LineWidth', 3 );
plot( [m1min, m1min+0.1], [d1bar, d1bar], 'w-', 'LineWidth', 3 );
plot( mp, dp, 'w:', 'LineWidth', 2 );
axis( [d1min, d1max, m1min, m1max] );
imagesc( [d1min, d1max], [m1min, m1max], P2 );
plot( mp, dp, 'w:', 'LineWidth', 2 );
plot( m1bar, d1bar, 'wo', 'LineWidth', 3 );
plot( [m1bar, m1bar], [d1max, d1max-0.1], 'w-', 'LineWidth', 3 );
plot( [m1min, m1min+0.1], [d1bar, d1bar], 'w-', 'LineWidth', 3 );
axis( [d1min, d1max, m1min, m1max] );
imagesc( [d1min, d1max], [m1min, m1max], P3 );
plot( mp, dp, 'w:', 'LineWidth', 2 );
plot( m1bar, d1bar, 'wo', 'LineWidth', 3 );
plot( Pmaxm1, Pmaxd1, 'ko', 'LineWidth', 3 );
plot( [m1bar, m1bar], [d1max, d1max-0.1], 'w-', 'LineWidth', 3 );
plot( [m1min, m1min+0.1], [d1bar, d1bar], 'w-', 'LineWidth', 3 );
plot( [Pmaxm1, Pmaxm1], [d1max, d1max-0.1], 'k-', 'LineWidth', 3 );
plot( [m1min, m1min+0.1], [Pmaxd1, Pmaxd1], 'k-', 'LineWidth', 3 );
fprintf('Caption: Prior pdf pA(d1,m1) (left) interacting with\n');
Caption: Prior pdf pA(d1,m1) (left) interacting with
fprintf('inexact theory pg(d1,m1) (middle) to produce total pdf pT(d1,m1)\n');
inexact theory pg(d1,m1) (middle) to produce total pdf pT(d1,m1)
fprintf('(right). In this case, the theory is very inexact\n');
(right). In this case, the theory is very inexact
% total distribution pT(m1,d1) and the projected
% distribution p(m) = (integral) pT(m1,d1) d(d1)
% highlighting the possibility that the maximum
% liklihood points of the two distributions are
% at two different values of m1
Dd1 = (d1max-d1min)/(Nd1-1);
d1 = d1min + Dd1*[0:Nd1-1]';
Dm1 = (m1max-m1min)/(Nm1-1);
m1 = m1min + Dm1*[0:Nm1-1]';
C1 = diag( [sd1^2, sm1^2]' );
% note not normaalized, so max is unity
x1 =[d1(i), m1(j)]' - bar;
P1(i,j) = exp( -0.5 * x1'*CI1*x1 );
% s-axis for parametric curve
r2 = (d1(i)-dp).^2 + (m1(j)-mp).^2;
P2(i,j) = exp( -r2min/sg2 );
Pmaxm1 = m1min+Dm1*(Pj-1);
Pmaxd1 = d1min+Dd1*(Pi-1);
% find maximum likelihood point
axis( [d1min, d1max, m1min, m1max] );
imagesc( [d1min, d1max], [m1min, m1max], P3 );
plot( mp, dp, 'w:', 'LineWidth', 2 );
plot( m1bar, d1bar, 'wo', 'LineWidth', 3 );
plot( Pmaxm1, Pmaxd1, 'ko', 'LineWidth', 3 );
plot( [m1bar, m1bar], [d1max, d1max-0.1], 'w-', 'LineWidth', 3 );
plot( [m1min, m1min+0.1], [d1bar, d1bar], 'w-', 'LineWidth', 3 );
plot( [Pmaxm1, Pmaxm1], [d1max, d1max-0.1], 'k-', 'LineWidth', 3 );
plot( [m1min, m1min+0.1], [Pmaxd1, Pmaxd1], 'k-', 'LineWidth', 3 );
fprintf('Caption: Total pdf pT(d,m) with prior value (white circle), maximum\n');
Caption: Total pdf pT(d,m) with prior value (white circle), maximum
fprintf('likelihood point (black cirle), and theory (dashed line) superimposed.\n');
likelihood point (black cirle), and theory (dashed line) superimposed.
axis( [m1min, m1max, 0, 1] );
plot( m1, Pm', 'b-', 'LineWidth', 3 );
plot( Pmm, max(Pm), 'ko', 'LineWidth', 3 );
fprintf('Caption: Projected pdf p(m)=(integral) pT(d,m) dd (blue curve) and\n');
Caption: Projected pdf p(m)=(integral) pT(d,m) dd (blue curve) and
fprintf('maximum likelihood point (black cirle).\n');
maximum likelihood point (black cirle).
% sample chi-squared analysis
% distribution of errors P (Phi), E and L
% for a problem of a band-limited timeseries
% with redundant noisy observations of the
% time series and with a priori smoothness
% make a wiggly curve m(t) by starting out with random noise
% and bandpass filtering it around a narrow range of angular
% frquencies centered on w0. The bandpass filtering is
% accomplished by the gda_chebyshevfilt() function, which
% though not mentioned in the text (sorry about that) is pretty
% easy to use and has many other applications. Its arguments are
% output_timeseries = gda_chebyshevfilt( input_timeseries, Dt, f1, f2 )
% where Dt is the sampling of the timeseries (say in s) and
% (f1,f2) are the (low,high) size of the frequency band (say in Hz)
mtrue = gda_chebyshevfilt( random('Normal',0,1,M,1), Dt, (w0-Dw)/(2*pi), (w0+Dw)/(2*pi) );
mtrue = A*mtrue/max(abs(mtrue));
% components of data kernel, all normalize to produce
% data of about the same value
% data kernel is just 3 independent observations of same point
G = [eye(M,M); eye(M,M); eye(M,M)];
dobs = dtrue + random('Normal',0,sigma_d,N,1);
sqrtcovdi = eye(N,N)/sigma_d;
% prior information: second derivative close to zero
H = (1/Dt^2)*toeplitz( [1; zeros(M-3,1)], [1, -2, 1, zeros(1,M-3) ] );
sigma_mdd = (w0^2)*A/sqrt(2);
sigma_mdd2 = std(mddtrue); % for test purposes
sqrtcovhi = eye(K,K)/sigma_mdd;
% overall least squares equation and its solution
F = [ sqrtcovdi*G; sqrtcovhi*H ];
f = [ sqrtcovdi*dobs; sqrtcovhi*h ];
sigma_mdd3 = std(mddest); % for test purposes
axis( [0, t(end), -1.1*A, 1.1*A] );
plot( t, dobs(1:M), 'b.', 'LineWidth', 2 );
plot( t, dobs(M+1:2*M), 'b.', 'LineWidth', 2 );
plot( t, dobs(2*M+1:3*M), 'b.', 'LineWidth', 2 );
plot( t, mtrue, 'k-', 'LineWidth', 4 );
plot( t, mest, 'r-', 'LineWidth', 2 );
fprintf('Caption: Bandlimited time series, m(t). True (black),\n');
Caption: Bandlimited time series, m(t). True (black),
fprintf('estimated (red), redundsnt observations (blue)\n');
estimated (red), redundsnt observations (blue)
e = sqrtcovdi*(G*mest-dobs); % normalized prediction error
l = sqrtcovhi*(H*mest-h); % normalized prior error
vP = N+K-M; % degrees of freeedom in PHI
vE = vP*N/(N+K); % approx degrees of freeedom in E
vL = vP*K/(N+K); % approx degrees of freeedom in L
% Chi-squared test of the Null Hypothesis
fprintf('Analytic 95%% confidence tests\n');
Analytic 95% confidence tests
if ( P>(vP-2*sqrt(2*vP)) && P<(vP+2*sqrt(2*vP)) )
fprintf('P %.2f vP %.2f null hypothesis cannot be rejected\n', P, vP);
fprintf('P %.2f vP %.2f null hypothesis can be rejected\n', P, vP);
end
P 358.43 vP 301.00 null hypothesis can be rejected
if ( E>(vE-2*sqrt(2*vE)) && E<(vE+2*sqrt(2*vE)) )
fprintf('E %.2f vE %.2f null hypothesis cannot be rejected\n', E, vE);
fprintf('E %.2f vE %.2f null hypothesis can be rejected\n', E, vE);
end
E 260.76 vE 226.87 null hypothesis cannot be rejected
if ( L>(vL-2*sqrt(2*vL)) && L<(vL+2*sqrt(2*vL)) )
fprintf('L %.2f vL %.2f null hypothesis cannot be rejected\n', L, vL);
fprintf('L %.2f vL %.2f null hypothesis can be rejected\n', L, vL);
end
L 97.67 vL 74.13 null hypothesis cannot be rejected
% Now do it lots of times to create empirical pdf's
dobs = dtrue + random('Normal',0,sigma_d,N,1);
f = [ sqrtcovdi*dobs; sqrtcovhi*h ];
e = sqrtcovdi*(G*mest-dobs);
l = sqrtcovhi*(H*mest-h);
Pvec(ireal) = Evec(ireal)+Lvec(ireal);
% empirical pdf's via histograms
Dbin = (binmax-binmin)/(Nbins-1);
bins = binmin + Dbin*[0:Nbins]';
Phist = hist( Pvec, bins );
Ehist = hist( Evec, bins );
Lhist = hist( Lvec, bins );
axis( [binmin, binmax, 0, top ] );
plot( bins,Phist, 'k-', 'LineWidth', 3 );
plot( [vP, vP], [0, top/5], 'r-', 'LineWidth', 2 );
plot( [vP-2*sqrt(2*vP), vP-2*sqrt(2*vP)], [0, top/10], 'b-', 'LineWidth', 4 );
plot( [vP+2*sqrt(2*vP), vP+2*sqrt(2*vP)], [0, top/10], 'b-', 'LineWidth', 4 );
axis( [binmin, binmax, 0, top ] );
plot( bins,Ehist, 'k-', 'LineWidth', 3 );
plot( [vE, vE], [0, top/5], 'r-', 'LineWidth', 2 );
plot( [vE-2*sqrt(2*vE), vE-2*sqrt(2*vE)], [0, top/10], 'b-', 'LineWidth', 4 );
plot( [vE+2*sqrt(2*vE), vE+2*sqrt(2*vE)], [0, top/10], 'b-', 'LineWidth', 4 );
axis( [binmin, binmax, 0, top ] );
plot( bins,Lhist, 'k-', 'LineWidth', 3 );
plot( [vL, vL], [0, top/10], 'r-', 'LineWidth', 2 );
plot( [vL-2*sqrt(2*vL), vL-2*sqrt(2*vL)], [0, top/10], 'b-', 'LineWidth', 4 );
plot( [vL+2*sqrt(2*vL), vL+2*sqrt(2*vL)], [0, top/10], 'b-', 'LineWidth', 4 );
fprintf('Caption: Empirical pdfs for (top) generalized error Phi,\n');
Caption: Empirical pdfs for (top) generalized error Phi,
fprintf('(middle) prediction error E and (bottom) error in prior information L\n');
(middle) prediction error E and (bottom) error in prior information L
fprintf('Also shown are mean z(red) and 95 percent confidence bounds (blue)\n');
Also shown are mean z(red) and 95 percent confidence bounds (blue)
% empirical confidence limits based on the empirical pdf's
fprintf('Numerical 95%% confidence tests\n');
Numerical 95% confidence tests
if ( p>0.025 && p<0.975 )
fprintf('P %.2f vP %.2f null hypothesis cannot be rejected\n', P, vP);
fprintf('P %.2f vP %.2f null hypothesis can be rejected\n', P, vP);
end
P 358.43 vP 301.00 null hypothesis cannot be rejected
if ( p>0.025 && p<0.975 )
fprintf('E %.2f vE %.2f null hypothesis cannot be rejected\n', E, vE);
fprintf('E %.2f vE %.2f null hypothesis can be rejected\n', E, vE);
end
E 260.76 vE 226.87 null hypothesis cannot be rejected
if ( p>0.025 && p<0.975 )
fprintf('L %.2f vL %.2f null hypothesis cannot be rejected\n', L, vL);
fprintf('L %.2f vL %.2f null hypothesis can be rejected\n', L, vL);
end
L 97.67 vL 74.13 null hypothesis cannot be rejected
% example F-test to assess difference in fit of two models
% the two models are linear and cubic fit of the same d(z)
dobs = dtrue + random('Normal', 0, sigmad, N, 1 );
plot(z,dobs,'ro','LineWidth',3);
% plot the predicted data for the linear fit
plot(z,dpreA,'b-','LineWidth',3);
fprintf('Caption: Linear fit (blue curve) to data (red circles)\n');
Caption: Linear fit (blue curve) to data (red circles)
EA = (dobs-dpreA)'*(dobs-dpreA);
vA = N-M; % degrees of freedom
fprintf('linear error %f, degrees of freedom %d\n', EA, vA);
linear error 0.019723, degrees of freedom 9
plot(z,dobs,'ro','LineWidth',3);
G=[ones(N,1), z, z.*z, z.^3];
% plot the predicted data for the cubic fit
plot(z,dpreB,'b-','LineWidth',3);
fprintf('Caption: Cubic fit (blue curve) to data (red circles)\n');
Caption: Cubic fit (blue curve) to data (red circles)
EB = (dobs-dpreB)'*(dobs-dpreB);
vB = N-M; % degrees of freedom
fprintf('cubic error %f, degrees of freedom %d\n', EB, vB);
cubic error 0.005425, degrees of freedom 7
Fobs = (EA/vA) / (EB/vB); % F-value
fprintf('1/F %f F %f', 1/Fobs, Fobs);
% probability value associated with F-value
P = 1 - (fcdf(Fobs,vA,vB)-fcdf(1/Fobs,vA,vB));
Pleft = fcdf(1/Fobs,vA,vB);
Pright = 1-fcdf(Fobs,vA,vB);
fprintf('P(F<%f) = %f\n', 1/Fobs, Pleft);
fprintf('P(F>%f) = %f\n', Fobs, Pright);
fprintf('P(F<%f or F>%f) = %f\n', 1/Fobs, Fobs, P);
P(F<0.353666 or F>2.827530) = 0.166663
if( (Pleft+Pright)<0.05 )
fprintf('Null Hypothesis can be rejected to 95%% confidence\n');
fprintf('Null Hypothesis cannot be rejected to 95%% confidence\n');
end
Null Hypothesis cannot be rejected to 95% confidence
% example of F test for problem with prior information
% dense set of model parameters
% densely sampled time t variable
% sparse set of model parameters
% sparsely sampled time t variable
% matrix D2S takes dense to sparse model parameters by decimation
% matrix S2D takes sparse to dense model parameters by linear interpolation
% make a densely sampled wiggly curve m(t) by starting out with random noise
% and bandpass filtering it around a narrow range of angular
% frquencies centered on w0. The bandpass filtering is
% accomplished by the gda_chebyshevfilt() function, which
% though not mentioned in the text (sorry about that) is pretty
% easy to use and has many other applications. Its arguments are
% output_timeseries = gda_chebyshevfilt( input_timeseries, Dt, f1, f2 )
% where Dt is the sampling of the timeseries (say in s) and
% (f1,f2) are the (low,high) size of the frequency band (say in Hz)
mtrue1 = gda_chebyshevfilt( random('Normal',0,1,M1,1), Dt1, (w0-Dw)/(2*pi), (w0+Dw)/(2*pi) );
mtrue1 = A*mtrue1/max(abs(mtrue1));
% data kernel is just 3 independent observations of same point
G1 = [eye(M1,M1); eye(M1,M1); eye(M1,M1)];
dobs = dtrue + random('Normal',0,sigma_d,N,1);
sqrtcovdi = eye(N,N)/sigma_d;
% prior information: second derivative close to zero
H1 = (1/Dt1^2)*toeplitz( [1; zeros(M1-3,1)], [1, -2, 1, zeros(1,M1-3) ] );
H2 = (1/Dt2^2)*toeplitz( [1; zeros(M2-3,1)], [1, -2, 1, zeros(1,M2-3) ] );
% prior covariance of model parameters
sigma_mdd = (w0^2)*A/sqrt(2);
sqrtcovhi1 = eye(K1,K1)/sigma_mdd;
sqrtcovhi2 = eye(K2,K2)/sigma_mdd;
% overall least squares equation and its solution
F1 = [ sqrtcovdi*G1; sqrtcovhi1*H1 ];
f1 = [ sqrtcovdi*dobs; sqrtcovhi1*h1 ];
mest1 = FTFinv1*(F1'*f1);
F2 = [ sqrtcovdi*G2; sqrtcovhi2*H2 ];
f2 = [ sqrtcovdi*dobs; sqrtcovhi2*h2 ];
mest2 = FTFinv2*(F2'*f2);
axis( [0, t1(end), -1.1*A, 1.1*A] );
plot( t1, dobs(1:M1), 'b.', 'LineWidth', 2 );
plot( t1, dobs(M1+1:2*M1), 'b.', 'LineWidth', 2 );
plot( t1, dobs(2*M1+1:3*M1), 'b.', 'LineWidth', 2 );
plot( t1, mtrue1, 'k-', 'LineWidth', 6 );
plot( t1, mest1, 'r-', 'LineWidth', 4 );
plot( t2, mest2, 'g:', 'LineWidth', 2 );
fprintf('Caption: Bandlimited time series, true (black), estimated\n');
Caption: Bandlimited time series, true (black), estimated
fprintf('sparse solution (red), estimated dense solution (green), data (blue dots)\n');
sparse solution (red), estimated dense solution (green), data (blue dots)
% error associated with dense problem
e1 = sqrtcovdi*(G1*mest1-dobs);
l1 = sqrtcovhi1*(H1*mest1-h1);
% error associated with sparse problem
e2 = sqrtcovdi*(G2*mest2-dobs);
l2 = sqrtcovhi2*(H2*mest2-h2);
Fobs = (PhiA/vA) / (PhiB/vB);
fprintf('1/F %f F %f\n', 1/Fobs, Fobs);
Pval = 1 - abs(fcdf(1/Fobs,vA,vB)-fcdf(Fobs,vA,vB));
Pleft = fcdf(1/Fobs,vA,vB);
Pright = 1-fcdf(Fobs,vA,vB);
fprintf('P(F<%f) = %f\n', 1/Fobs, Pleft);
fprintf('P(F>%f) = %f\n', Fobs, Pright);
fprintf('P(F<%f or F>%f) = %f\n', 1/Fobs, Fobs, Pval);
P(F<0.975905 or F>1.024690) = 0.832575
if( (Pleft+Pright)<0.05 )
fprintf('Null Hypothesis can be rejected to 95%% confidence\n');
fprintf('Null Hypothesis cannot be rejected to 95%% confidence\n');
end
Null Hypothesis cannot be rejected to 95% confidence
% now do a whole lot of the same problems
% with different realizations of observational noise
dobs = dtrue + random('Normal',0,sigma_d,N,1);
f1 = [ sqrtcovdi*dobs; sqrtcovhi1*h1 ];
mest1 = FTFinv1*(F1'*f1);
e1 = sqrtcovdi*(G1*mest1-dobs);
l1 = sqrtcovhi1*(H1*mest1-h1);
dobs = dtrue + random('Normal',0,sigma_d,N,1);
f2 = [ sqrtcovdi*dobs; sqrtcovhi2*h2 ];
mest2 = FTFinv2*(F2'*f2);
e2 = sqrtcovdi*(G2*mest2-dobs);
l2 = sqrtcovhi2*(H2*mest2-h2);
FFvec(ireal) = (PP1/vP1) / (PP2/vP2);
% histogram and empirical p.d.f.
Dbin = (binmax-binmin)/(Nbins-1);
bins = binmin + Dbin*[0:Nbins]';
FFhist = hist( FFvec, bins );
FFhist = FFhist/(Dbin*sum(FFhist));
axis( [binmin, binmax, 0, top ] );
plot( bins,FFhist, 'k-', 'LineWidth', 3 );
plot( bins,fpdf(bins,vP1,vP2), 'r-', 'LineWidth', 3 );
plot( [Fobs,Fobs]', [0, top/5]', 'k-', 'LineWidth', 4 );
plot( [FFmean,FFmean]', [0, top/5]', 'g-', 'LineWidth', 4 );
plot( [finv(0.5,vP1,vP2),finv(0.5,vP1,vP2)]', [0, top/5]', 'r-', 'LineWidth', 4 );
plot( [finv(0.025,vP1,vP2),finv(0.025,vP1,vP2)]', [0, top/8]', 'b-', 'LineWidth', 4 );
plot( [finv(0.975,vP1,vP2),finv(0.975,vP1,vP2)]', [0, top/8]', 'b-', 'LineWidth', 4 );
fprintf('Caption: Analytic pdf p(F) (red curve), empirical pdf (black curve)\n');
Caption: Analytic pdf p(F) (red curve), empirical pdf (black curve)
fprintf('observed F (black bar), empirical mean (green bar), true mean (red bar)\n');
observed F (black bar), empirical mean (green bar), true mean (red bar)
fprintf('95 percent confidence (blue bars)\n');
95 percent confidence (blue bars)