This repository has been archived on 2021-05-17. You can view files and clone it, but cannot push or open issues or pull requests.
scientificComputing/statistics/matlab/ci_mean.m
Fabian Sinz 763b332eea done
2014-10-16 17:53:22 +02:00

20 lines
390 B
Matlab

load thymusglandweights.dat
n = 16;
x = thymusglandweights(1:n);
m = 5000;
me = zeros(m,1);
for i = 1:m
me(i) = median(x(randi(n,n,1)));
end
t025 = tinv(0.025, n-1);
t975 = tinv(0.975, n-1);
se = std(x)/sqrt(n);
fprintf('bootstrap quantiles: %.4f, %.4f \n', quantile(me,0.025), quantile(me,0.975));
fprintf('analytical quantile: %.4f, %.4f \n', mean(x)+t025*se, mean(x)+t975*se);