Chapter 3: scale parameters
Chapter 3: scale parameters
The left- and right-hand solid-line plots are obtained in Matlab with the commands:
%create data vector
N=8; d=randn([N 1]); d=(d-mean(d))*3/std(d); %data (mean=0, std=3)
%Fig 1 (SD units)
SDs=.005:.01:7-.005; %create vector of possible SD values
poSD=exp(-N/2*(mean(d.^2)-mean(d)^2)./SDs.^2).*SDs.^-N; %posterior
figure(1); plot(SDs,poSD/max(poSD),'k.'); hold on; axis([0 7 0 1])
%Fig 2 (variance units)
Vs=SDs.^2; %create vector of possible variance values
poV=exp(-N/2*(mean(d.^2)-mean(d)^2)./Vs).*Vs.^(-N/2); %posterior
figure(2); plot(Vs, poV/max(poV),'k.'); hold on; axis([0 15 0 1])