This method was the jackknife.
This is the first time that the sample was manipulated,
each observation is dropped once from the sample,
when the
observation has been dropped,
we call the estimator
and their average is
We can use the jackknife for estimating the bias by:
We showed in class that if the bias is of the order
as in
then the Jackknife estimate is
in
We can show that if the bias is of the order
as in
then the Jackknife estimate is
in
FEVAL Execute function specified by string.
If F is a string containing the name of a function (usually
defined by an M-file), then FEVAL(F,x1,...,xn) evaluates
that function at the given arguments.
For example, F = 'foo', FEVAL(F,9.64) is the same as foo(9.64).
FEVAL is usually used inside functions which have the names of
other functions as arguments. Examples include FZERO and EZPLOT.
[y1,..,yn] = FEVAL(F,x1,...,xn) returns multiple output arguments.
Within methods that overload built-in functions, use
BUILTIN(FUN,...) to execute the original built-in function.
See also BUILTIN.
%------------------------------------------
function out=jackbias(theta,orig)
%Estimate the bias using the jackknife
%Theta has to be a character string containg
% a valid function name
[n,p]=size(orig);
lot=feval(theta,orig(2:n,:));
k=length(lot);
lo=zeros(n,k);
lo(1,:)=lot;
lo(n,:)=feval(theta,orig(1:(n-1),:));
for i=(2:(n-1))
lo(i,:)=feval(theta,orig([1:(i-1),(i+1):n],:));
end
thetadot=mean(lo);
out=(n-1)*thetadot -(n-1)*feval(theta,orig);
%-------------------------------
function out=ratio(yszs)
%Computes the ratio of mean of first
%column of mean of second column
out=mean(yszs(:,1))/mean(yszs(:,2));
%-------------------------------------
>>z=oldpatch-placebo ; y=newpatch-oldpatch
>> yz=[y,z]
-1200 8406
2601 2342
-2705 8187
1982 8459
-1290 4795
351 3516
-638 4796
-2719 10238
>>ratio(yz)
-0.0713
>> jackbias('ratio',yz)
ans = 0.0080
Bootstrap Simulations
function out=bootbias(theta,orig,B)
thetabs=zeros(1,B);
for b=(1:B)
bs=bsample(orig);
thetabs(b)=feval(theta,bs);
end
theta0=feval(theta,orig);
out=mean(thetabs)-theta0;
%-----------------------------------
>> bootbias('ratio',yz,1000)
ans = 0.0085
%-----------------------------------
function out=bootmultin(orig,B)
[n,p]=size(orig);
out=zeros(B,n);
for b=1:B
inds=randint(1,n,n)+1;
for i=1:n
out(b,inds(i))=out(b,inds(i))+1;
end;
end
%-----------------------------------
>> bootmultin(law15,5)
1 1 2 0 1 1 0 1 3 0 2 2 1 0 0
3 1 0 1 2 2 0 1 2 2 0 0 0 0 1
0 0 0 3 0 4 3 0 2 0 1 0 0 1 1
1 1 2 2 0 1 1 0 2 1 1 1 0 0 2
2 0 0 2 2 0 0 0 0 1 3 3 0 2 0