% Credible Set
close all
set(0, 'DefaultAxesFontSize', 16);

  xx = 0:0.1:20;
  yy = chi2pdf(xx, 10);
  plot(xx, yy, 'k-','LineWidth',2)
  hold on
  xxx = 4.2:0.1:13.6;
  yyy = chi2pdf(xxx, 10);
  %
  fill([4.2 xxx 13.6], [0 yyy 0], 'y')
  plot(xx, yy, 'k-','LineWidth',2)
  %
  plot(xx, 0.05 * ones(length(xx)), 'r--', 'LineWidth',2)
  plot(xxx, 0.05 * ones(length(xxx)), 'r-', 'LineWidth',2)
  plot([4.2 4.2],[0.05 0],'r:')
  plot([13.6 13.6],[0.05 0],'r:')
  plot([4.2 13.6],[0.05, 0.05],'ko', 'MarkerFaceColor','g','MarkerSize',6)
  plot([4.2 13.61],[0.0, 0.0],'b-','LineWidth',20)
  text('Interpreter','latex',...
	'String','$\pi(\theta|x)$',...
	'Position',[11 .09],...
	'FontSize',20)
  text('Interpreter','latex',...
	'String','HPD $(1-\alpha) \times 100\%$ Credible Set',...
	'Position',[5 .01],...
	'FontSize',12)
  text('Interpreter','latex',...
	'String','$1-\alpha$',...
	'Position',[7.5 .045],...
	'FontSize',20)
xlabel('\theta')
%print -depsc 'C:\Springer\Bayes\Bayeseps\credibleset.eps'
