<< ciboot Resampling covjack >>

Stixbox >> Stixbox > Resampling > covboot

covboot

Bootstrap estimate of the variance of a parameter estimate.

Calling Sequence

c=covboot(x,T)
c=covboot(x,T,b)
[c,y]=covboot(...)

Parameters

x :

a matrix of doubles

T :

a function or a list, the function which computes the empirical estimate from x.

b :

a 1-by-1 matrix of doubles, the number of resamples (default b=200)

c :

a matrix of doubles, the variance-covariance matrix

y :

a m-by-b matrix of doubles, the parameter estimates of the resamples, where m is the size of the parameter estimate.

Description

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)
where 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.

Examples

// 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"))

Authors


Report an issue
<< ciboot Resampling covjack >>