% % epage 241 % % 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'); load forearm; B = 400; % for the skewness: [bootstat,bootsam] = parm_bootstrap( B, @skewness, forearm ); bt_est = mean( bootstat ); std_err = std( bootstat ); fprintf( 'the estimated skewness is given by %10.5f\n', skewness(forearm) ); fprintf( 'the bootstrap computed standard error of the skewness is given by %10.5f\n', std_err ); fprintf( 'the bootstrap computed estimate of the bias of the skewness is given by %10.5f\n', bt_est - skewness(forearm) ); % for the kurtosis: [bootstat,bootsam] = parm_bootstrap( B, @kurtosis, forearm ); bt_est = mean( bootstat ); % <- the bootstrap estimate of the mean ... std_err = std( bootstat ); % <- the bootstrap estimate of the standard error ... fprintf( 'the estimated kurtosis is given by %10.5f\n', kurtosis(forearm) ); fprintf( 'the bootstrap computed standard error of the kurtosis is given by %10.5f\n', std_err ); fprintf( 'the bootstrap computed estimate of the bias of the kurtosis is given by %10.5f\n', bt_est - kurtosis(forearm) ); % the standard percentile interval for the sample second moment: % technically "var" is not the sample second moment but for this exercise the approximation is OK % the cstoolbox function "mom" didn't seem to work B = 1500; [bootstat,bootsam] = parm_bootstrap( B, @var, forearm ); alpha = 0.1; qhat = quantile( bootstat, [ 0.5*alpha, 1-0.5*alpha ] ); fprintf( 'the bootstrap computed estimates percentile interval of the variance is given by:\n' ); fprintf( '%10.5f', qhat ); fprintf('\n');