ce(xl(1),xl(2));
  hold on
  plot(xx,invchi1pf(xx,res.N0,sqrt(res.S20)))
  hold off
  legend('posterior','prior')
end

%%
% A point estimate of the model parameters can be calculated as the
% mean of the |chain|. Here we plot the fitted model using the
% posterior means of the parameters.

x = linspace(0,400)';
figure(1)
hold on
plot(x,modelfun(x,mean(chain)),'-k')
hold off
legend({'data','model'},'Location','best')

%%
% Instead of just a point estimate of the fit, we should also study
% the predictive pos