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-fabian/matlab/winners_curse.m

22 lines
340 B
Matlab

load thymusglandweights.dat
n = 10;
x = thymusglandweights;
m = 5000;
for i = 1:m
idx = randi(length(x), n,1);
y = x(idx);
[h,p] = ttest(y, 34.3);
if h == 1
disp(['p-value: ', num2str(p)]);
disp(['mu: ', num2str(mean(y))]);
disp(['mu total: ', num2str(mean(x))]);
break
end
end