load thymusglandweights.dat
x = thymusglandweights(1:50);

m = 500;
n = length(x);
x = sort(x);
me = zeros(m,1);
for i = 1:m
    me(i) = median(x(randi(n,n,1)));
end

a1 = binoinv(0.025,n,.5)-1;
a2 = binoinv(1-0.025,n,.5);

fprintf('bootstrap quantiles: %.4f, %.4f \n', quantile(me,0.025), quantile(me,1-0.025));
fprintf('analytical quantile: %.4f, %.4f \n', x(a1),x(a2));

