No BSD License  

Highlights from
Bootstrap prediction error rate

image thumbnail

Bootstrap prediction error rate



15 Apr 2007 (Updated )

(Application of BSTRAP)

function[res] = bpredfun2(zest,zval)
% BPREDERR helper function, passed to BSTATS.Inputs estimation and
% validation samples, each in a matrix of form z = [y x], computes
% OLS estimates for the estimation sample, and calculates  squared
% prediction error vector for those validation-sample observations
% that are not found in the estimation sample. 
% EXAMPLE <none> (Oh, the FEX code metrics..)  

iest = zest(:,1); yest = zest(:,2); xest = zest(:,3:end);
ival = zval(:,1); yval = zval(:,2); xval = zval(:,3:end);

best = regress(yest,xest);    
eval = yval - xval*best;      
nval = length(eval);

for i = 1:nval
    j = find(iest == ival(i));
    if ~isempty(j)
        eval(i) = nan;

res.b = best;
res.e = eval.^2;

Contact us