function [mnjack,sig,mnunbias,bias] = jackstat(est,jackest)
% [mnjack,sig,mnunbias,bias] = jackstat(est,jackest)      
% Estimates a given statistic using jackknife-sample.
%
% Input:
% est=estimate based on the whole sample 
% jackest=vector of estimates based on the jackknife-samples
% (These may be taken from the output of jackknife.m)
%
% Output:
% mnjack= mean of jackest, i.e. the jackknife estimate
% bias= jackknife estimate of bias, 
% mnunbias=bias-corrected estimate (using the original estimate)
% sig=jackknife estimate of standard error of estimate
%
% References:
%         [1] B. Efron & R.J. Tibshirani: "An Introduction to the Bootstrap"

[nrow ncol]= size(jackest);
% the jackknife estimate (page 141, equation 11.4)
mnjack = mean(jackest);
% estimate the bias (page 134, equation 10.30)
bias = (nrow-1)*(mnjack-est);
% estimate the bias-corrected mean (page 138, equation 10.40)
mnunbias = est-bias;
% estimate the standard deviation (page 141, equation 11.5)
sig = std(jackest)*(nrow-1)/sqrt(nrow);
