📄 in practice.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0066)http://www-stat.stanford.edu/~susan/courses/b494/index/node53.html -->
<!--Converted with LaTeX2HTML 2K.1beta (1.57)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>In practice</TITLE>
<META content="In practice" name=description>
<META content=t name=keywords>
<META content=document name=resource-type>
<META content=global name=distribution>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2523" name=GENERATOR>
<META http-equiv=Content-Style-Type content=text/css><LINK
href="In practice.files/t.css" rel=STYLESHEET><LINK href="node54.html"
rel=next><LINK href="node52.html" rel=previous><LINK href="node52.html"
rel=up><LINK href="node54.html" rel=next></HEAD>
<BODY><!--Navigation Panel--><A
href="http://www-stat.stanford.edu/~susan/courses/b494/index/node54.html"
name=tex2html899><IMG height=24 alt=next src="In practice.files/next.png"
width=37 align=bottom border=0></A> <A
href="http://www-stat.stanford.edu/~susan/courses/b494/index/node52.html"
name=tex2html895><IMG height=24 alt=up src="In practice.files/up.png" width=26
align=bottom border=0></A> <A
href="http://www-stat.stanford.edu/~susan/courses/b494/index/node52.html"
name=tex2html889><IMG height=24 alt=previous src="In practice.files/prev.png"
width=63 align=bottom border=0></A> <A
href="http://www-stat.stanford.edu/~susan/courses/b494/index/node124.html"
name=tex2html897><IMG height=24 alt=index src="In practice.files/index.png"
width=43 align=bottom border=0></A> <BR><B>Next:</B> <A
href="http://www-stat.stanford.edu/~susan/courses/b494/index/node54.html"
name=tex2html900>S examples for simple</A> <B>Up:</B> <A
href="http://www-stat.stanford.edu/~susan/courses/b494/index/node52.html"
name=tex2html896>The bootstrap : the</A> <B>Previous:</B> <A
href="http://www-stat.stanford.edu/~susan/courses/b494/index/node52.html"
name=tex2html890>The bootstrap : the</A> <B><A
href="http://www-stat.stanford.edu/~susan/courses/b494/index/node124.html"
name=tex2html898>Index</A></B> <BR><BR><!--End of Navigation Panel-->
<H2><A name=SECTION00311000000000000000>In practice</A> </H2>From an original
sample <BR>
<P></P>
<DIV align=center><!-- MATH \begin{displaymath}{\cal X}_n=(X_1,X_2...X_n) \stackrel{iid}{\sim} F\end{displaymath} --><IMG
height=39
alt="\begin{displaymath}{\cal X}_n =(X_1,X_2...X_n) \stackrel{iid}{\sim} F\end{displaymath}"
src="In practice.files/img290.png" width=29 border=0> </DIV><BR clear=all>
<P></P>draw a new sample of <IMG height=18 alt=$n$
src="In practice.files/img10.png" width=16 align=bottom border=0> observations
among the original sample with replacement, each observation having the same
probabilty of being drawn (<IMG height=32 alt=$=\frac{1}{n}$
src="In practice.files/img291.png" width=486 align=middle border=0>). The
bootstrap sample is often denoted <BR>
<P></P>
<DIV align=center><!-- MATH \begin{displaymath}{\cal X}_n^*=X_1^*,X_2^*...X_n^* \stackrel{iid}{\sim} F_n\mbox{ the empirical distribution }\end{displaymath} --><IMG
height=46
alt="\begin{displaymath}{\cal X}_n^* =X_1^*,X_2^*...X_n^* \stackrel{iid}{\sim} F_n \mbox{ the empirical distribution }\end{displaymath}"
src="In practice.files/img292.png" width=97 border=0> </DIV><BR clear=all>
<P></P>
<P>If we are interested in the behaviour of a random variable <!-- MATH $\widehat{\theta}=\theta({\cal X},F)$ --><IMG height=46
alt="$\widehat{\theta}=\theta({\cal X},F)$" src="In practice.files/img293.png"
width=109 align=middle border=0>, then we can consider the sequence of <IMG
height=17 alt=$B$ src="In practice.files/img199.png" width=20 align=bottom
border=0> new values obtained through computation of <IMG height=17 alt=$B$
src="In practice.files/img199.png" width=20 align=bottom border=0> new bootstrap
samples.
<P>Practically speaking this will need generatation of an integer between 1 and
n, each of these integers having the same probability through a function denoted
by <I>RANINT(1,n)</I> hereof.
<P>Here is an example of a line of matlab that does just that: <PRE>T= floor((rand(1)*n)+1);
</PRE>
<P>If we use S we won't need to generate the new observations one by one, the
following command generates a n-vector with replacement in the vector of indices
(1...n).
<P><PRE>sample(n,n,replace=T)
</PRE>
<P>An approximation of the distribution of the estimate <!-- MATH $\widehat{\theta}=\theta({\cal X}_n,F)$ --><IMG height=32
alt="$\widehat{\theta}=\theta({\cal X}_n,F)$" src="In practice.files/img294.png"
width=389 align=middle border=0> is provided by the distribution of <BR>
<P></P>
<DIV align=center><!-- MATH \begin{displaymath}\widehat{\theta}^{*b}=\theta({\cal X}_n^{*b},F_n), \ \ b=1..B\end{displaymath} --><IMG
height=52
alt="\begin{displaymath}\widehat{\theta}^{*b}= \theta({\cal X}_n^{*b},F_n), \ \ b=1..B \end{displaymath}"
src="In practice.files/img295.png" width=171 border=0> </DIV><BR clear=all>
<P></P><!-- MATH $G_n^*(t)=P_{F_n}\left(\widehat{\theta}^* \leq t \right)$ --><IMG
height=23 alt="$G_n^*(t)=P_{F_n}\left( \widehat{\theta}^* \leq t \right)$"
src="In practice.files/img296.png" width=22 align=middle border=0> denotes the
bootstrap distribution of <!-- MATH $\widehat{\theta}^*$ --><IMG height=32
alt=$\widehat{\theta}^*$ src="In practice.files/img297.png" width=368
align=bottom border=0>, often approximated by <BR>
<P></P>
<DIV align=center><!-- MATH \begin{displaymath}\widehat{G}_n^*(t)=\#\{\widehat{\theta}^*\leq t\}/B\end{displaymath} --><IMG
height=45
alt="\begin{displaymath} \widehat{G}_n^*(t)= \char93 \{\widehat{\theta}^* \leq t \}/B\end{displaymath}"
src="In practice.files/img298.png" width=226 border=0> </DIV><BR clear=all>
<P></P>
<P><I><!-- MATH $\fbox{The Bootstrap Algorithm}$ --><IMG height=34
alt="\fbox{The Bootstrap Algorithm}" src="In practice.files/img299.png" width=29
align=middle border=0> </I>
<P>
<OL>
<LI>For b=1 to B do : /* B is the number of bootstrap samples */
<OL>
<LI>For i=1 to n do : /* Generation of Sample <IMG height=46
alt="${\cal X}_b^*$" src="In practice.files/img300.png" width=95
align=middle border=0> */
<OL>
<LI>OBS=RANINT(1,n)
<LI>Add observation number OBS to Sample <IMG height=46
alt="${\cal X}_b^*$" src="In practice.files/img300.png" width=95
align=middle border=0> </LI></OL>
<LI>Compute <!-- MATH $\widehat{\theta}^*_b=\theta({\cal X}_b^*)$ --><IMG
height=31 alt="$\widehat{\theta}^*_b=\theta({\cal X}_b^*)$"
src="In practice.files/img301.png" width=363 align=middle border=0>
</LI></OL></LI></OL>
<P>An example data set is LS (or laws) : the law school data consisting in 15
bivariate data points, each corresponding to an American law school as analysed
in E<SMALL>FRON 1982</SMALL>: <BR>
<P></P>
<DIV align=center><!-- MATH \begin{displaymath}x_i=(LSAT_i,GPA_i)\end{displaymath} --><IMG
height=34 alt="\begin{displaymath} x_i=(LSAT_i,GPA_i)\end{displaymath}"
src="In practice.files/img302.png" width=54 border=0> </DIV><BR clear=all>
<P></P><IMG height=34 alt=$LSAT_i$ src="In practice.files/img303.png" width=54
align=middle border=0> is the class average score on a nationwide exam, <IMG
height=34 alt=$GPA_i$ src="In practice.files/img304.png" width=26 align=middle
border=0> is the class average undergraduate grades.
<P>In order to repeat a large number of times the same instructions needed to
construct <IMG height=17 alt=$B$ src="In practice.files/img199.png" width=20
align=bottom border=0> data sets one usually has to use a looping facility,
actually matlab and S are easier to program in this circumstance because one can
use ordinary loops and use owner-created functions, as well as trying to benefit
form the vectorized commands.
<P>
<HR>
<!--Navigation Panel--><A
href="http://www-stat.stanford.edu/~susan/courses/b494/index/node54.html"
name=tex2html899><IMG height=24 alt=next src="In practice.files/next.png"
width=37 align=bottom border=0></A> <A
href="http://www-stat.stanford.edu/~susan/courses/b494/index/node52.html"
name=tex2html895><IMG height=24 alt=up src="In practice.files/up.png" width=26
align=bottom border=0></A> <A
href="http://www-stat.stanford.edu/~susan/courses/b494/index/node52.html"
name=tex2html889><IMG height=24 alt=previous src="In practice.files/prev.png"
width=63 align=bottom border=0></A> <A
href="http://www-stat.stanford.edu/~susan/courses/b494/index/node124.html"
name=tex2html897><IMG height=24 alt=index src="In practice.files/index.png"
width=43 align=bottom border=0></A> <BR><B>Next:</B> <A
href="http://www-stat.stanford.edu/~susan/courses/b494/index/node54.html"
name=tex2html900>S examples for simple</A> <B>Up:</B> <A
href="http://www-stat.stanford.edu/~susan/courses/b494/index/node52.html"
name=tex2html896>The bootstrap : the</A> <B>Previous:</B> <A
href="http://www-stat.stanford.edu/~susan/courses/b494/index/node52.html"
name=tex2html890>The bootstrap : the</A> <B><A
href="http://www-stat.stanford.edu/~susan/courses/b494/index/node124.html"
name=tex2html898>Index</A></B> <!--End of Navigation Panel-->
<ADDRESS>Susan Holmes 2002-01-12 </ADDRESS></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -