%  script_bootstrap
% suppose our data consists of the 15 values
x=sort([156    33   212   228    85   319   318   196   232  217   181   272   141   418   186])
% the sample mean is 212.93 and these are assumed to be a random sample from some kind of distribution with
%poluation mean mu.
mse=[];
disp(['The median of the data is ' num2str(median(x))])
disp('To estimate mean squared error of this estimate, use 10 bootstrap samples')
pause
y=sort(sample(x,length(x)))
disp(['median of boostrap sample ' num2str(median(y))])
disp(['mean squared error of bootstrap sample ' num2str((median(y)-median(x))^2)])
pause
for i=1:10
    disp(' ')
disp(['The median of the data is ' num2str(median(x))])
disp('To estimate mean squared error of this estimate, use 10 bootstrap samples')
y=sort(sample(x,length(x)))
disp(['median of boostrap sample ' num2str(median(y))])
ms=(median(y)-median(x))^2;  mse=[mse ms];
disp(['mean squared error of bootstrap sample ' num2str(ms)])
end
disp(['average mse ' num2str(mean(mse))])
