A
download covboot.m
Language: Matlab
LOC: 37
Project Info
MatLinks/Chorus(matlinks)
Server: SourceForge
Type: cvs
...chest\copyleft\gpl\stixbox\
   bincoef.m
   cat2tbl.m
   ciboot.m
   ciquant.m
   cmpmod.m
   Contents.m
   contincy.m
   corr.m
   covboot.m
   covjack.m
   cvar.m
   datas1.m
   datas10.m
   datas11.m
   datas2.m
   datas3.m
   datas4.m
   datas5.m
   datas6.m
   datas7.m
   datas8.m
   datas9.m
   dbeta.m
   dbinom.m
   dchisq.m
   df.m
   dgamma.m
   dgumbel.m
   dhypg.m
   dlognorm.m
   dnorm.m
   dt.m
   dweib.m
   egumbel.m
   getdata.m
   histo.m
   identif5.m
   identify.m
   kaplamai.m
   ldiscrim.m
   linreg.m
   lodds.m
   loddsinv.m
   logitfit.m
   lsfit.m
   lsselect.m
   normmix.m
   octvinit.m
   pairs.m
   pbeta.m
   pbinom.m
   pchisq.m
   pf.m
   pgamma.m
   pgumbel.m
   phypg.m
   plognorm.m
   plotdens.m
   plotempd.m
   plotsym.m
   pnorm.m
   pt.m
   pweib.m
   qbeta.m
   qbinom.m
   qchisq.m
   qf.m
   qgamma.m
   qgumbel.m
   qhypg.m
   qlognorm.m
   qnorm.m
   qqgamma.m
   qqgumbel.m
   qqnorm.m
   qqplot.m
   qqweib.m
   qt.m
   quantile.m
   qweib.m
   ranktrf.m
   rbeta.m
   rbinom.m
   rboot.m
   rchisq.m
   Readme.m
   rf.m
   rgamma.m
   rgumbel.m
   rhypg.m
   rlognorm.m
   rnorm.m
   rt.m
   rweib.m
   spearman.m
   stdboot.m
   stdize.m
   stdjack.m
   stixdemo.m
   test1b.m
   test1n.m
   test1r.m
   test2n.m
   test2r.m

function [C,y] = covboot(x,theta,B,p1,p2,p3,p4,p5,p6,p7,p8,p9)
%COVBOOT  Bootstrap estimate of the variance of a parameter estimate.
%
%	  C = covboot(X,'T')
%	  
%	  Computes the T(X) many times using resampled data and  
%	  uses the result to compute an estimate of the variance  
%         of T(X) assuming that X is a representative sample from  
%         the underlying distribution of X. If T is multidimensional 
%         then the covariance matrix is estimated. An optional third 
%	  input argument sets the number of resamples, default is 200.
%
%	  See also COV, COVJACK, and CIBOOT.

%       Anders Holtsberg, 11-01-95
%       Copyright (c) Anders Holtsberg

arglist = [];
for i = 4:nargin
   arglist = [arglist, ',p', num2str(i-3)];
end
if nargin < 3
   B = 200;
end
if min(size(x)) == 1
   x = x(:);
end

% Now, for functions that are known to produce columnwise 
% results it is faster to avoid the forloop! Note that
% there are functions that cannot be included, i e "cov".

colWiseFun = strcmp(theta,'mean') | ...
	     strcmp(theta,'std') | ...
	     strcmp(theta,'median') | ...
	     strcmp(theta,'quantile');
	     
[n,nx] = size(x);
evalstring = [theta,'(xb',arglist,')'];
xb = rboot(x);
s = eval(evalstring);
y = [s(:) zeros(length(s(:)),B-1)];
if nx == 1 & colWiseFun
   Bchunk = ceil(40000/n);
   i = 1;
   while i<B
      Bnext = min(B-i,Bchunk);
      xb = rboot(x,Bnext);
      y(:,i+(1:Bnext)) = eval(evalstring);
      i = i + Bnext;
   end
else
   for i = 2:B
      xb = rboot(x);
      yy = eval(evalstring);
      y(:,i) = yy(:);
   end
end

C = cov(y')*(B/(B-1));

About Koders | Resources | Downloads | Support | Black Duck | Terms of Service | DMCA | Privacy Policy | Contact Us