Chapter 5: temperature measurement with multiplicative noise
First we measure a single temperature that lumps the three datasets, and then we simultaneously measure three temperatures under the multiplicative noise assumption. The multiplicative noise parameter (sigma) is measured more reliably with multiple datasets at multiple separate temperatures, because it remains constant across temperatures.
Single-location measurement:
In the case of making observations at a single location (single true temperature), the two unknowns in the model require us to simultaneously compute the 2d location-scale posterior, and then marginalize over each in turn to obtain the relevant 1d posteriors.
d1=[98.4 97.5 98.8 98.6 99.2];
d2=[100.4 100.8 100.5 101.4 101.9];
d3=[105.5 104.5 104.2 104.9 105.8];
d=[d1 d2 d3];
Nmu=151; Nsigma=51;
mus=linspace(90,110,Nmu)';
sigmas=linspace(0,5,Nsigma+1); sigmas=sigmas(2:end);
N=[length(d1) length(d2) length(d3)];
Nd=sum(N);
%%% plot marginal sigma distribution
Lms=-(Nd/2*((mean(d.^2)-mean(d)^2)*((mus*sigmas).^-2)+(mus*ones(size(sigmas))-mean(d)).^2.*((mus*sigmas).^-2))+(Nd+1)*log((mus*sigmas)));
Lm=logsum(Lms,2,diff(sigmas(1:2))); Lm=Lm-max(Lm);
figure(1); subplot(2,1,1); cla; hold on
plot(mus,exp(Lm),'k:','LineWidth',2);
Mulit-location measurement:
Contrast the above with a separate measurement for each of the three datasets.
Nmu=151; Nsigma=101;
mus=linspace(96,108,Nmu)';
sigmas=linspace(0,2,Nsigma+1)/100; sigmas=sigmas(2:end);
%%% 4d mu1-mu2-sigma distribution
Lm123s=zeros(Nmu,Nmu,Nmu,Nsigma);
for m=1:Nmu, if m==round(Nmu/3), disp('1/3'); elseif m==round(Nmu/2), disp('1/2'); elseif m==round(2*Nmu/3), disp('2/3'); end
for s=1:Nsigma,
Lm123s(m,:,:,s)=-(N(1)/2*((mean(d1.^2)-mean(d1)^2)*((mus(m)*sigmas(s))^-2)+(mus(m)-mean(d1)).^2./(mus(m)*sigmas(s)).^2)+(N(1)+1)*log((mus(m)*sigmas(s))))...
-(N(2)/2*((mean(d2.^2)-mean(d2)^2)*((mus*ones(size(mus'))*sigmas(s)).^-2)+(mus*ones(size(mus'))-mean(d2)).^2./(mus*ones(size(mus'))*sigmas(s)).^2)+(N(1)+1)*log((mus*ones(size(mus'))*sigmas(s))))...
-(N(3)/2*((mean(d3.^2)-mean(d3)^2)*((ones(size(mus))*mus'*sigmas(s)).^-2)+(ones(size(mus))*mus'-mean(d3)).^2./(ones(size(mus))*mus'*sigmas(s)).^2)+(N(2)+1)*log((ones(size(mus))*mus'*sigmas(s)))); end, end
Lm123=logsum(Lm123s,4,diff(sigmas(1:2)));
%%% marginal mu1 distribution
Lm1=logsum(Lm123,2:3,diff(mus(1:2))*[1 1]); Lm1=Lm1-max(Lm1);
subplot(2,1,1); hold on
ciM=CIp(mus,Lm1);
plot(mus,exp(Lm1),'k--','LineWidth',1.75); axis([97 108 0 1])
for n=1:2, plot(ciM(n)*[1 1],[0 1],'-','Color',.65*[1 1 1],'LineWidth',.7); end
%%% marginal mu2 distribution
Lm2=logsum(Lm123,[1 3],diff(mus(1:2))*[1 1]); Lm2=Lm2-max(Lm2);
subplot(2,1,1); hold on
ciM=CIp(mus,Lm2);
plot(mus,exp(Lm2),'k--','LineWidth',1.75); axis([97 108 0 1])
for n=1:2, plot(ciM(n)*[1 1],[0 1],'-','Color',.65*[1 1 1],'LineWidth',.7); end
%%% marginal mu3 distribution
Lm3=logsum(Lm123,[1:2],diff(mus(1:2))*[1 1]); Lm3=Lm3-max(Lm3);
subplot(2,1,1); hold on
ciM=CIp(mus,Lm3);
plot(mus,exp(Lm3),'k--','LineWidth',1.75); axis([97 108 0 1])
for n=1:2, plot(ciM(n)*[1 1],[0 1],'-','Color',.65*[1 1 1],'LineWidth',.7); end
%%% marginal sig distribution
Ls=logsum(Lm123s,[1:3],diff(mus(1:2))*[1 1 1]); Ls=Ls-max(Ls);
subplot(2,1,2); cla; hold on
ciS=CIp(sigmas,Ls);
plot(sigmas,exp(Ls),'k--','LineWidth',1.75); axis([0 0.02 0 1])
for n=1:2, plot(ciS(n)*[1 1],[0 1],'-','Color',.65*[1 1 1],'LineWidth',.7); end