Chapter 3: exponential posteriors derived from jeffreys priors

The function pTX.m returns the approximate transformation of a probability distribution, pORIG in original coordinates (cOrig) via the linking function f. This function was used extensively to create plots in Appendix C. Here, it will be used to compare different parameterizations of the same posteriors derived from Jeffreys priors. To do so, we must first create pOrig based on both parameterizations of the exponential distribution.

n=30; tbar=3; tdat=n*tbar;

tau=linspace(0,20,502); tau=tau(2:end); sig=1./tau; sig=sig(end:-1:1);

pritau=tau.^-1; Ltau=tau.^-n.*exp(-tdat./tau); ptau=pritau.*Ltau;

prisig=sig.^-1; Lsig=sig.^n.*exp(-tdat*sig); psig=prisig.*Lsig;

Once the posterior distributions in their original coordinates (ptau and psig) have been computed, we are in a position to compute the approximate transformed versions of each of these. We first define the linking function:

f=@(x) x.^-1;

to be used in pTX.m. We then define the two transformed priors and posteriors.

prisigx=pTX(tau,pritau,f); psigx=prisigx(:,1).*Lsig';

pritaux=pTX(sig,prisig,f); ptaux=pritaux(:,1).*Ltau';

From here, we can create plots:

figure(1); clf; hold on; box off; xlabel('tau'); ylabel('p[tau|data]')

plot(tau,ptau/max(ptau),'ko','MarkerFaceColor','k','MarkerSize',8,'LineWidth',2);

plot(pritaux(:,2),ptaux/max(ptaux),'b-','LineWidth',2)

axis([0 10 0 1])

figure(2); clf; hold on; box off; xlabel('sig'); ylabel('p[sig|data]')

plot(sig,psig/max(psig),'ko','MarkerFaceColor','k','MarkerSize',8,'LineWidth',2);

plot(prisigx(:,2),psigx/max(psigx),'b-','LineWidth',2)

axis([0 1 0 1])