load tumor.dat



y=tumor(:,1); n=tumor(:,2);

theta=log((n.*y+.5)./(n.*(1-y)+.5));

lambda=[1 1];

hpar=[0 100 1 1];

m=2000; b=1000;



S=cihm(tumor,'f_bin','g_normal','h_normal',theta,lambda,hpar,m,b); 

pt=prctile(S(:,1:70),[2.5 50 97.5]);                       % compute percentiles
p=exp(pt)./(1+exp(pt));                                    % transform to probs
errorbar(tumor(:,1),p(2,:),p(2,:)-p(1,:),p(3,:)-p(2,:),'o')% plot errorbars
axis([-.02 .45 -.02 .45]);line([0 .45],[0 .45])            % plot line on top
xlabel('observed rate, y(i)')                              % label
ylabel('95% posterior interval for p(i)')                  % axes
print -deps 'c:\matlab\bayes\gexch\plot.eps'