⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 node11.htm

📁 matlab bootstrap程序设计方法
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<!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>Some notation</TITLE><META NAME="description" CONTENT="Some notation"><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="node12.html"><LINK REL="previous" HREF="node10.html"><LINK REL="up" HREF="node6.html"><LINK REL="next" HREF="node12.html"></HEAD><BODY ><!--Navigation Panel--><A NAME="tex2html302"  HREF="node12.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="tex2html300"  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="tex2html294"  HREF="node10.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="tex2html303"  HREF="node12.html">Complete Enumeration</A><B> Up:</B> <A NAME="tex2html301"  HREF="node6.html">Lectures</A><B> Previous:</B> <A NAME="tex2html295"  HREF="node10.html">The bootstrap: Some Examples</A><BR><BR><!--End of Navigation Panel--><!--Table of Child-Links--><A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A><UL><LI><A NAME="tex2html304"  HREF="node11.html#SECTION00251000000000000000">Accuracy of the sample mean</A><UL><LI><A NAME="tex2html305"  HREF="node11.html#SECTION00251100000000000000">Mouse example</A></UL><BR><LI><A NAME="tex2html306"  HREF="node11.html#SECTION00252000000000000000">The combinatorics of the bootstrap distribution</A><UL><LI><A NAME="tex2html307"  HREF="node11.html#SECTION00252100000000000000">How many different bootstrap samples are there?</A><LI><A NAME="tex2html308"  HREF="node11.html#SECTION00252200000000000000">Which is the most likely bootstrap sample?</A><LI><A NAME="tex2html309"  HREF="node11.html#SECTION00252300000000000000">The <FONT COLOR="#ff0000">multinomial</FONT> distribution</A></UL></UL><!--End of Table of Child-Links--><HR><H1><A NAME="SECTION00250000000000000000">Some notation</A></H1><BODY bgcolor="#FFFFFF">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 WIDTH="197" HEIGHT="33" BORDER="0" SRC="img27.png" ALT="\begin{displaymath}{\cal X}_n=(X_1,X_2...X_n) \stackrel{iid}{\sim} F\end{displaymath}"></DIV><BR CLEAR="ALL"><P></P>draw a new sample of <IMG WIDTH="16" HEIGHT="16" ALIGN="BOTTOM" BORDER="0" SRC="img28.png" ALT="$n$">observations among the original sample<FONT COLOR="#ff0000">with</FONT> replacement, each observation having the same probabiltyof being drawn (<IMG WIDTH="37" HEIGHT="40" ALIGN="MIDDLE" BORDER="0" SRC="img29.png" ALT="$=\frac{1}{n}$">).A 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 WIDTH="408" HEIGHT="33" BORDER="0" SRC="img30.png" ALT="\begin{displaymath}{\cal X}_n^*=X_1^*,X_2^*...X_n^* \stackrel{iid}{\sim} F_n\mbox{ the empirical distribution }\end{displaymath}"></DIV><BR CLEAR="ALL"><P></P><P>If we are interested in thebehaviour of a random variable<!-- MATH $\widehat{\theta}=\theta({\cal X}_n,F)$ --><IMG WIDTH="108" HEIGHT="45" ALIGN="MIDDLE" BORDER="0" SRC="img31.png" ALT="$\widehat{\theta}=\theta({\cal X}_n,F)$">,then we can consider the sequenceof <IMG WIDTH="20" HEIGHT="16" ALIGN="BOTTOM" BORDER="0" SRC="img32.png" ALT="$B$"> new values obtained throughcomputation of <IMG WIDTH="20" HEIGHT="16" ALIGN="BOTTOM" BORDER="0" SRC="img32.png" ALT="$B$"> new bootstrap samples.<P>Practically speaking this willneed generatation ofan integer between 1 and n,each of these integers having the same probability.<P>Here is an example of a line of <TT>matlab</TT> that does justthat:<TT>indices=randint(1,n,n)+1;</TT>Or if you have the statistics toolbox,you can use:<TT>indices=unidrnd(n,1,n);</TT><P>If we use S we won't need to generate the new observations one by one, the following command generatesa n-vector with replacement in the vectorof indices (1...n).<P><TT>sample(n,n,replace=T)  </TT><P>An approximation of the distribution of theestimate <!-- MATH $\widehat{\theta}=\theta({\cal X}_n,F)$ --><IMG WIDTH="108" HEIGHT="45" ALIGN="MIDDLE" BORDER="0" SRC="img31.png" ALT="$\widehat{\theta}=\theta({\cal X}_n,F)$">is provided by the distributionof <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 WIDTH="219" HEIGHT="33" BORDER="0" SRC="img33.png" ALT="\begin{displaymath}\widehat{\theta}^{*b}=\theta({\cal X}_n^{*b},F_n),   b=1..B\end{displaymath}"></DIV><BR CLEAR="ALL"><P></P><!-- MATH $G_n^*(t)=P_{F_n}\left(\widehat{\theta}^* \leq t \right)$ --><IMG WIDTH="176" HEIGHT="47" ALIGN="MIDDLE" BORDER="0" SRC="img34.png" ALT="$G_n^*(t)=P_{F_n}\left(\widehat{\theta}^* \leq t \right)$">denotesthe bootstrap distributionof <!-- MATH $\widehat{\theta}^*$ --><IMG WIDTH="21" HEIGHT="21" ALIGN="BOTTOM" BORDER="0" SRC="img35.png" ALT="$\widehat{\theta}^*$">,oftenapproximated by <BR><P></P><DIV ALIGN="CENTER"><!-- MATH \begin{displaymath}\widehat{G}_n^*(t)=\#\{\widehat{\theta}^*\leq t\}/B\end{displaymath} --><IMG WIDTH="176" HEIGHT="33" BORDER="0" SRC="img36.png" ALT="\begin{displaymath}\widehat{G}_n^*(t)=\char93 \{\widehat{\theta}^*\leq t\}/B\end{displaymath}"></DIV><BR CLEAR="ALL"><P></P><P><I><!-- MATH $\fbox{The Bootstrap Algorithm}$ --><IMG WIDTH="225" HEIGHT="46" ALIGN="MIDDLE" BORDER="0" SRC="img37.png" ALT="\fbox{The Bootstrap Algorithm}"></I><P><OL><LI>Compute the original estimate from the original data.<!-- MATH $\widehat{\theta}=\theta({\cal X}_n)$ --><IMG WIDTH="85" HEIGHT="45" ALIGN="MIDDLE" BORDER="0" SRC="img38.png" ALT="$\widehat{\theta}=\theta({\cal X}_n)$"></LI><LI>For b=1 to B do :  %B is the number of bootstrap samples <OL><LI>Create a resample <IMG WIDTH="29" HEIGHT="35" ALIGN="MIDDLE" BORDER="0" SRC="img39.png" ALT="${\cal X}_b^*$"> </LI><LI>Compute <!-- MATH $\widehat{\theta}^*_b=\theta({\cal X}_b^*)$ --><IMG WIDTH="94" HEIGHT="45" ALIGN="MIDDLE" BORDER="0" SRC="img40.png" ALT="$\widehat{\theta}^*_b=\theta({\cal X}_b^*)$"></LI></OL> </LI><LI>Compare <!-- MATH $\widehat{\theta}^*_b$ --><IMG WIDTH="21" HEIGHT="45" ALIGN="MIDDLE" BORDER="0" SRC="img41.png" ALT="$\widehat{\theta}^*_b$"> to <!-- MATH $\widehat{\theta}$ --><IMG WIDTH="14" HEIGHT="21" ALIGN="BOTTOM" BORDER="0" SRC="img42.png" ALT="$\widehat{\theta}$">.</LI></OL><P><H2><A NAME="SECTION00251000000000000000">Accuracy of the sample mean</A></H2>Using the linearity of the mean and the fact thatthe sample is iid we have <BR><P></P><DIV ALIGN="CENTER"><!-- MATH \begin{displaymath}\widehat{se}(\bar{x})= \sqrt{\frac{s^2}{n}}\end{displaymath} --><IMG WIDTH="103" HEIGHT="55" BORDER="0" SRC="img43.png" ALT="\begin{displaymath}\widehat{se}(\bar{x})= \sqrt{\frac{s^2}{n}}\end{displaymath}"></DIV><BR CLEAR="ALL"><P></P>where <IMG WIDTH="21" HEIGHT="19" ALIGN="BOTTOM" BORDER="0" SRC="img44.png" ALT="$s^2$"> is the usual estimate of the varianceobtained from the sample.<P>If we were given <IMG WIDTH="20" HEIGHT="16" ALIGN="BOTTOM" BORDER="0" SRC="img32.png" ALT="$B$"> true samples, and their associatedestimates <!-- MATH $\hat{\theta^{*b}}$ --><IMG WIDTH="27" HEIGHT="23" ALIGN="BOTTOM" BORDER="0" SRC="img45.png" ALT="$\hat{\theta^{*b}}$">,we could compute the usual variance estimatefor this sample of <IMG WIDTH="20" HEIGHT="16" ALIGN="BOTTOM" BORDER="0" SRC="img32.png" ALT="$B$"> values, namely:<BR><P></P><DIV ALIGN="CENTER"><!-- MATH \begin{displaymath}\widehat{se}_{boot}(s)=\{ \sum_{b=1}^B[s(\mbox{${\cal X}$}^{*b})-s(\mbox{${\cal X}$}^{*.})]^2/(B-1)\}^{\frac{1}{2}}\end{displaymath} --><IMG WIDTH="357" HEIGHT="59" BORDER="0" SRC="img46.png" ALT="\begin{displaymath}\widehat{se}_{boot}(s)=\{ \sum_{b=1}^B[s(\mbox{${\cal X}$}^{*b})-s(\mbox{${\cal X}$}^{*.})]^2/(B-1)\}^{\frac{1}{2}}\end{displaymath}"></DIV><BR CLEAR="ALL"><P></P>where <BR><P></P><DIV ALIGN="CENTER"><!-- MATH \begin{displaymath}s(\mbox{${\cal X}$}^{*.})]=\frac{1}{B}\sum_{b=1}^B s(\mbox{${\cal X}$}^{*b})\end{displaymath} --><IMG WIDTH="179" HEIGHT="59" BORDER="0" SRC="img47.png" ALT="\begin{displaymath}s(\mbox{${\cal X}$}^{*.})]=\frac{1}{B}\sum_{b=1}^B s(\mbox{${\cal X}$}^{*b})\end{displaymath}"></DIV><BR CLEAR="ALL"><P></P><P><H3><A NAME="SECTION00251100000000000000">Mouse example</A></H3>Here are  some computations for the mouse data(page 11 of text)<IMG SRC="Mouse-8sm.jpg", width=200><P><TABLE  WIDTH="300"><TR><TD><B>Treatment Group</B><PRE>treat=[94 38 23 197 99 16 141]'treat =    94    38    23   197    99    16   141&gt;&gt; median(treat)         ans =    94&gt;&gt; mean(treat)ans =   86.8571&gt;&gt; var(treat)ans =   4.4578e+03&gt;&gt; var(treat)/7ans =  636.8299&gt;&gt; sqrt(637)ans =   25.2389thetab=zeros(1,1000);for (b =(1:1000))               thetab(b)=median(bsample(treat));endhist(thetab)&gt;&gt; sqrt(var(thetab))ans =   37.7768&gt;&gt; mean(thetab)ans =   80.5110

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -