% % problem 268 % example epage 250 % % Written by: % -- % John L. Weatherwax 2008-02-20 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- clear all; close all; clc; addpath('../../Code/CSTool'); %n = 25; n = 15; x = rand(1,n); % compute the bootstrapped standard confidence interval (of the mean): B = 1000; [m] = bootstrp( B, @mean, x ); fprintf( 'The bootstrap estimated standard error is given by %10.5f\n', std(m) ); % compute the jackknifed estimate standard confidence interval (of the mean): jack = zeros(1,n); % <- store the jackknifed samples for ii=1:n jack(ii) = mean( x( setdiff(1:n,ii) ) ); end % get the mean of the jackknifed estimates TJ = mean(jack); jackEstStdError = sqrt( ((n-1)/n)*sum( ( jack - TJ ).^2 ) ); fprintf( 'The jackknifed estimated standard error is given by %10.5f\n', jackEstStdError ); % assume the theoretical estimate of the standard error for the mean % (when the draws are from the uniform distribution) is sigma/sqrt(n) % for a uniform distribution [0,1] => sigma = 1/sqrt(12) tese = (1/sqrt(12))/sqrt(n); fprintf( 'The theoretical estimated standard error is given by %10.5f\n', tese );