Bootstrap estimate of the variance of a parameter estimate.
c=covboot(x,T) c=covboot(x,T,b) [c,y]=covboot(...)
a matrix of doubles
a function or a list, the function which computes the empirical estimate from x.
a 1-by-1 matrix of doubles, the number of resamples (default b=200)
a matrix of doubles, the variance-covariance matrix
a m-by-b matrix of doubles, the parameter estimates of the resamples, where m is the size of the parameter estimate.
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.
The function T must have the following header:
p=T(x)
x
is the sample or the resample
and p
is a m-by-1 matrix of doubles.
In the case where the parameter estimate has a more general
shape (e.g. 2-by-2), the shape of p
is reshaped
into a column vector with m
components.
See "T and extra arguments" for details on how to pass extra-arguments to T.
If T is multidimensional then the covariance matrix is estimated.
// Case where the parameter to estimate is univariate: // estimate a mean n = 20; x=distfun_chi2rnd(3,n,1); mean(x) c=covboot(x,mean) c=covboot(x,mean,50000) [c,y]=covboot(x,mean); size(y) // Case where the parameter to estimate is multivariate: // estimate a covariance n = 20; X1=distfun_chi2rnd(3,n,1); X2=distfun_unifrnd(0,1,n,1); X3=distfun_normrnd(0,1,n,1); x = [X1,X2+X3]; cov(x) c=covboot(x,cov) [c,y]=covboot(x,cov); size(y) // Test with a user-defined function. function y=mymean(x) y=mean(x) endfunction n = 20; x=distfun_chi2rnd(3,n,1); c=covboot(x,mymean) // With extra-arguments for T. x=distfun_chi2rnd(3,20,5); mean(x,"r") c=covboot(x,list(mean,"r")) // With extra-arguments for T, and // multivariante case x=distfun_chi2rnd(3,20,5); c=covboot(x,list(mean,"r")) | ![]() | ![]() |