% bs_ex2.m: Bootstrap example for PCA % % from pp. 61-70 of Efron & Tibshirani % RTB 5/31/02 % NOTE: For compatibility with different web browsers, % this file has been renamed 'poissonTutorial.txt'. In % order to use it in MATLAB, you should rename it as % 'poissonTutorial.m' and then open it up with the % MATLAB editor. % do 200 iterations of the bootstrap nboot = 200; % load test score data from Mardia et al. 1979; p. 62 load bs_data.txt; X = bs_data; % calculate the observed value [PC,SCORE,LATENT,TSQUARE] = princomp(X); th = LATENT(1) / sum(LATENT); % calculate the standard error of the variance estimate TH = bootstrp(nboot, 'pca', X); std(TH); % 95% CI myalpha = 0.05; ci = std(TH) * norminv(1-myalpha/2); thHi = th + ci thLo = th - ci