node16.htm
来自「matlab bootstrap程序设计方法」· HTM 代码 · 共 469 行
HTM
469 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><!--Converted with LaTeX2HTML 2002-2 (1.70)original version by: Nikos Drakos, CBLU, University of Leeds* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan* with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --><HTML><HEAD><TITLE>The jackknife</TITLE><META NAME="description" CONTENT="The jackknife"><META NAME="keywords" CONTENT="web1"><META NAME="resource-type" CONTENT="document"><META NAME="distribution" CONTENT="global"><META NAME="Generator" CONTENT="LaTeX2HTML v2002-2"><META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"><LINK REL="STYLESHEET" HREF="web1.css"><LINK REL="next" HREF="node17.html"><LINK REL="previous" HREF="node15.html"><LINK REL="up" HREF="node6.html"><LINK REL="next" HREF="node17.html"></HEAD><BODY ><!--Navigation Panel--><A NAME="tex2html375" HREF="node17.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/home/depot/swtree/depot/latex2html-2002-2/latex2html-2002-2/icons/next.png"></A> <A NAME="tex2html373" HREF="node6.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/home/depot/swtree/depot/latex2html-2002-2/latex2html-2002-2/icons/up.png"></A> <A NAME="tex2html367" HREF="node15.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/home/depot/swtree/depot/latex2html-2002-2/latex2html-2002-2/icons/prev.png"></A> <BR><B> Next:</B> <A NAME="tex2html376" HREF="node17.html">Cross Validation</A><B> Up:</B> <A NAME="tex2html374" HREF="node6.html">Lectures</A><B> Previous:</B> <A NAME="tex2html368" HREF="node15.html">More about the theoretical</A><BR><BR><!--End of Navigation Panel--><!--Table of Child-Links--><A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A><UL><LI><UL><LI><A NAME="tex2html377" HREF="node16.html#SECTION002100100000000000000">Example: Patch Data</A></UL></UL><!--End of Table of Child-Links--><HR><H1><A NAME="SECTION002100000000000000000">The jackknife</A></H1>A little history, the first idea related to the bootstrapwas Von-Mises, who used the plug-in principlein the 1930's. Then in the late 50's Quenouillefound a way of correcting the bias forestimators whosebias was known to be of the form:<BR><P></P><DIV ALIGN="CENTER"><!-- MATH \begin{displaymath}(*) \qquad \frac{a_1}{n}+\frac{a_2}{n^2}+\frac{a_3}{n^4}+\cdots\end{displaymath} --><IMG WIDTH="216" HEIGHT="41" BORDER="0" SRC="img215.png" ALT="\begin{displaymath}(*) \qquad \frac{a_1}{n}+\frac{a_2}{n^2}+\frac{a_3}{n^4}+\cdots\end{displaymath}"></DIV><BR CLEAR="ALL"><P></P>Even if the numerators are unkowns dependingon the real distribution <IMG WIDTH="19" HEIGHT="16" ALIGN="BOTTOM" BORDER="0" SRC="img1.png" ALT="$F$">.<P>This method was the <TT>jackknife</TT>.<IMG SRC="tcpredth.gif", width=200><IMG SRC="fish.gif", width=200,alt="Pic of Jackknife Fish><P>This is the first time that the sample was manipulated,each observation is dropped once from the sample,when the <IMG WIDTH="29" HEIGHT="17" ALIGN="BOTTOM" BORDER="0" SRC="img216.png" ALT="$ith$"> observation has been dropped,we call the estimator <!-- MATH $\hat{\theta}_{(i)}=s(\mbox{${\cal X}$}_{(i)})$ --><IMG WIDTH="110" HEIGHT="45" ALIGN="MIDDLE" BORDER="0" SRC="img217.png" ALT="$\hat{\theta}_{(i)}=s(\mbox{${\cal X}$}_{(i)})$">and their average is <!-- MATH $\hat{\theta}_{(.)}=\frac{1}{n}\sum_{i=1}^n \hat{\theta}_{(i)}$ --><IMG WIDTH="136" HEIGHT="45" ALIGN="MIDDLE" BORDER="0" SRC="img218.png" ALT="$\hat{\theta}_{(.)}=\frac{1}{n}\sum_{i=1}^n \hat{\theta}_{(i)}$"><BR><P></P><DIV ALIGN="CENTER"><!-- MATH \begin{displaymath}\mathbf{\mbox{${\cal X}$}}_{(i)} = (x_1, x_2, \ldots x_{i-1}, x_{i+1}, \ldots x_n)\end{displaymath} --><IMG WIDTH="275" HEIGHT="34" BORDER="0" SRC="img219.png" ALT="\begin{displaymath}\mathbf{\mbox{${\cal X}$}}_{(i)} = (x_1, x_2, \ldots x_{i-1}, x_{i+1}, \ldots x_n)\end{displaymath}"></DIV><BR CLEAR="ALL"><P></P><P>We can use the jackknife for estimating the bias by:<BR><P></P><DIV ALIGN="CENTER"><!-- MATH \begin{displaymath}\widehat{Bias}_{\mbox{jack}} = (n-1) (\hat{\theta}_{(\cdot)}-\hat{\theta})\end{displaymath} --><IMG WIDTH="225" HEIGHT="39" BORDER="0" SRC="img220.png" ALT="\begin{displaymath}\widehat{Bias}_{\mbox{jack}} = (n-1)(\hat{\theta}_{(\cdot)}-\hat{\theta})\end{displaymath}"></DIV><BR CLEAR="ALL"><P></P><P>We showed in class that if the bias is of the order <IMG WIDTH="17" HEIGHT="40" ALIGN="MIDDLE" BORDER="0" SRC="img221.png" ALT="$\frac{1}{n}$">as in <IMG WIDTH="29" HEIGHT="37" ALIGN="MIDDLE" BORDER="0" SRC="img222.png" ALT="$(*)$"> then the Jackknife estimate isin <IMG WIDTH="23" HEIGHT="40" ALIGN="MIDDLE" BORDER="0" SRC="img223.png" ALT="$\frac{1}{n^2}$"><P>We can show that if the bias is of the order <IMG WIDTH="17" HEIGHT="40" ALIGN="MIDDLE" BORDER="0" SRC="img221.png" ALT="$\frac{1}{n}$">as in <IMG WIDTH="29" HEIGHT="37" ALIGN="MIDDLE" BORDER="0" SRC="img222.png" ALT="$(*)$"> then the Jackknife estimate isin <IMG WIDTH="23" HEIGHT="40" ALIGN="MIDDLE" BORDER="0" SRC="img223.png" ALT="$\frac{1}{n^2}$"><BR><P></P><DIV ALIGN="CENTER"><!-- MATH \begin{displaymath}E_F \hat{\theta}_{(\cdot)}=E_{n-1}=\theta+\frac{a_1(F)}{n-1}+\frac{a_2(F)}{(n-1)^2}+\cdots\end{displaymath} --><IMG WIDTH="358" HEIGHT="52" BORDER="0" SRC="img224.png" ALT="\begin{displaymath}E_F \hat{\theta}_{(\cdot)}=E_{n-1}=\theta+\frac{a_1(F)}{n-1}+\frac{a_2(F)}{(n-1)^2}+\cdots \end{displaymath}"></DIV><BR CLEAR="ALL"><P></P><BR><P></P><DIV ALIGN="CENTER"><!-- MATH \begin{displaymath}\mbox{The Jackknife estimate is:}\qquad \tilde{\theta}=\hat{\theta}-\widehat{Bias}_{\mbox{jack}}=\hat{\theta} -(n-1) (\hat{\theta}_{(\cdot)}-\hat{\theta})=n\hat{\theta}-(n-1)\hat{\theta}_{(\cdot)}\end{displaymath} --><IMG WIDTH="677" HEIGHT="39" BORDER="0" SRC="img225.png" ALT="\begin{displaymath}\mbox{The Jackknife estimate is:}\qquad \tilde{\theta}=\hat{......dot)}-\hat{\theta})=n\hat{\theta}-(n-1)\hat{\theta}_{(\cdot)}\end{displaymath}"></DIV><BR CLEAR="ALL"><P></P><BR><P></P><DIV ALIGN="CENTER"><!-- MATH \begin{displaymath}E_F \tilde{\theta}= E_F(\hat{\theta}-\widehat{Bias}_{\mbox{jack}})= E_F(n\hat{\theta}-(n-1)\hat{\theta}_{(\cdot)})=nE_{n}-(n-1)E_{(n-1)}=\theta-\frac{a_2(F)}{n(n-1)}+{a_3(F)}(\frac{1}{n^2}+\frac{1}{(n-1)^2}+\cdots\end{displaymath} --><IMG WIDTH="878" HEIGHT="52" BORDER="0" SRC="img226.png" ALT="\begin{displaymath}E_F \tilde{\theta}= E_F(\hat{\theta}-\widehat{Bias}_{\mbox{j......2(F)}{n(n-1)}+{a_3(F)}(\frac{1}{n^2}+\frac{1}{(n-1)^2}+\cdots \end{displaymath}"></DIV><BR CLEAR="ALL"><P></P>So the order of the bias has been decreased from <!-- MATH $O(\frac{1}{n})$ --><IMG WIDTH="46" HEIGHT="40" ALIGN="MIDDLE" BORDER="0" SRC="img227.png" ALT="$O(\frac{1}{n})$">to <!-- MATH $O(\frac{1}{n^2})$ --><IMG WIDTH="53" HEIGHT="40" ALIGN="MIDDLE" BORDER="0" SRC="img228.png" ALT="$O(\frac{1}{n^2})$">Example:<BR>Suppose <!-- MATH $\theta=var(X)=\int_{supp(F)} (x-\mu)^2dF$ --><IMG WIDTH="273" HEIGHT="39" ALIGN="MIDDLE" BORDER="0" SRC="img229.png" ALT="$\theta=var(X)=\int_{supp(F)} (x-\mu)^2dF$">for which the plug in estimate is:<BR><P></P><DIV ALIGN="CENTER"><!-- MATH \begin{displaymath}\hat{\theta}=\int_{supp(F_n)} (x-\mu(F_n))^2dF_n=\frac{1}{n}\sum (x_i-\bar{x})^2\end{displaymath} --><IMG WIDTH="369" HEIGHT="49" BORDER="0" SRC="img230.png" ALT="\begin{displaymath}\hat{\theta}=\int_{supp(F_n)} (x-\mu(F_n))^2dF_n=\frac{1}{n}\sum (x_i-\bar{x})^2\end{displaymath}"></DIV><BR CLEAR="ALL"><P></P><P><BR><P></P><DIV ALIGN="CENTER"><!-- MATH \begin{displaymath}\hat{\sigma^2}^{JK}= \frac{1}{n-1}\sum_{i=1}^n (x_i-\bar{x})^2\end{displaymath} --><IMG WIDTH="209" HEIGHT="55" BORDER="0" SRC="img231.png" ALT="\begin{displaymath}\hat{\sigma^2}^{JK}= \frac{1}{n-1}\sum_{i=1}^n (x_i-\bar{x})^2\end{displaymath}"></DIV><BR CLEAR="ALL"><P></P><P><H3><A NAME="SECTION002100100000000000000">Example: Patch Data</A></H3>We are interested in the parameter<BR><P></P><DIV ALIGN="CENTER"><!-- MATH \begin{displaymath}\theta=\frac{|E(\mbox{new patch}-\mbox{old patch})|}{E(\mbox{old patch}-\mbox{placebo})}\end{displaymath} --><IMG WIDTH="261" HEIGHT="52" BORDER="0" SRC="img232.png" ALT="\begin{displaymath}\theta=\frac{\vert E(\mbox{new patch}-\mbox{old patch})\vert}{E(\mbox{old patch}-\mbox{placebo})}\end{displaymath}"></DIV><BR CLEAR="ALL"><P></P><B>Jackknife</B><IMG WIDTH="34" HEIGHT="16" ALIGN="BOTTOM" BORDER="0" SRC="img233.png" ALT="$z=$">old <IMG WIDTH="19" HEIGHT="33" ALIGN="MIDDLE" BORDER="0" SRC="img234.png" ALT="$-$">placebo, <IMG WIDTH="34" HEIGHT="33" ALIGN="MIDDLE" BORDER="0" SRC="img235.png" ALT="$y=$"> new <IMG WIDTH="19" HEIGHT="33" ALIGN="MIDDLE" BORDER="0" SRC="img234.png" ALT="$-$"> old.<BR><B>MATLAB Note</B><PRE> 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.</PRE><P><PRE>%------------------------------------------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],:)); endthetadot=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 columnout=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</PRE><P><B>Bootstrap Simulations</B><PRE>function out=bootbias(theta,orig,B)thetabs=zeros(1,B);for b=(1:B) bs=bsample(orig); thetabs(b)=feval(theta,bs);endtheta0=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:Binds=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 03 1 0 1 2 2 0 1 2 2 0 0 0 0 10 0 0 3 0 4 3 0 2 0 1 0 0 1 11 1 2 2 0 1 1 0 2 1 1 1 0 0 22 0 0 2 2 0 0 0 0 1 3 3 0 2 0</PRE><P><HR><!--Navigation Panel--><A NAME="tex2html375" HREF="node17.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/home/depot/swtree/depot/latex2html-2002-2/latex2html-2002-2/icons/next.png"></A> <A NAME="tex2html373" HREF="node6.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/home/depot/swtree/depot/latex2html-2002-2/latex2html-2002-2/icons/up.png"></A> <A NAME="tex2html367" HREF="node15.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/home/depot/swtree/depot/latex2html-2002-2/latex2html-2002-2/icons/prev.png"></A> <BR><B> Next:</B> <A NAME="tex2html376" HREF="node17.html">Cross Validation</A><B> Up:</B> <A NAME="tex2html374" HREF="node6.html">Lectures</A><B> Previous:</B> <A NAME="tex2html368" HREF="node15.html">More about the theoretical</A><!--End of Navigation Panel--><ADDRESS>Susan Holmes2004-05-19</ADDRESS></BODY></HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?