当前位置:高等教育资讯网  >  中国高校课件下载中心  >  大学文库  >  浏览文档

中国科学技术大学:《实用统计软件》课程课件讲义(统计计算与软件)第七讲 Boostrap方法和Jackknife方法(自助和刀切)

资源类别:文库,文档格式:PDF,文档页数:49,文件大小:709.98KB,团购合买
1 Bootstrap and Jackknife 1.1 The Bootstrap 1.1.1 Bootstrap Estimation of Standard Error 1.1.2 Bootstrap Estimation of Bias 1.2 Jackknife 1.3 Jackknife-after-Bootstrap 1.4 Bootstrap Confidence Intervals 1.4.1 The Standard Normal Bootstrap Confidence Interval 1.4.2 The Percentile Bootstrap Confidence Interval 1.4.3 The Basic Bootstrap Confidence Interval 1.4.4 The Bootstrap t interval 1.5 Better Bootstrap Confidence Intervals 1.6 Application: Cross Validation
点击下载完整版文档(PDF)

Lecture7:Bootstrap(自助)方法和 Jackknife(刀切)方法 张伟平 Thursday 19th July,2018

Lecture 7: Bootstrap(gœ)ê{⁄ Jackknife( É)ê{ ‹ï² Thursday 19th July, 2018

Contents 1 Bootstrap and Jackknife y 1.1 The Bootstrap........·..·..···.·.····· 1.1.1 Bootstrap Estimation of Standard Error ......5 l.l.2 Bootstrap Estimation of Bias·....。..:·。.·11 1.2 Jackknife..·。.·。·.···········。···· 16 l.3 Jackknife-after-Bootstrap.················· 22 1l.4 Bootstrap Confidence Intervals·..·.··.··.···· 26 1.4.1 The Standard Normal Bootstrap Confidence Interval 26 1.4.2 The Percentile Bootstrap Confidence Interval ...27 l.4.3 The Basic Bootstrap Confidence Interval.······ 28 1.4.4 The Bootstrap t interval.......·.·.····· 31 1.5 Better Bootstrap Confidence Intervals............ 35 l.6 Application:Cross Validation·.:...·.....··.·· 41 Previous Next First Last Back Forward 1

Contents 1 Bootstrap and Jackknife 1 1.1 The Bootstrap . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.1.1 Bootstrap Estimation of Standard Error . . . . . . . 5 1.1.2 Bootstrap Estimation of Bias . . . . . . . . . . . . . 11 1.2 Jackknife . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 1.3 Jackknife-after-Bootstrap . . . . . . . . . . . . . . . . . . . 22 1.4 Bootstrap Confidence Intervals . . . . . . . . . . . . . . . . 26 1.4.1 The Standard Normal Bootstrap Confidence Interval 26 1.4.2 The Percentile Bootstrap Confidence Interval . . . . 27 1.4.3 The Basic Bootstrap Confidence Interval . . . . . . . 28 1.4.4 The Bootstrap t interval . . . . . . . . . . . . . . . . 31 1.5 Better Bootstrap Confidence Intervals . . . . . . . . . . . . 35 1.6 Application: Cross Validation . . . . . . . . . . . . . . . . . 41 Previous Next First Last Back Forward 1

Chapter 1 Bootstrap and Jackknife 1.1 The Bootstrap Efron在1979,1981和1982年的工作中引入和进一步发展了Bootstarp方法,此 后发表了大量的关于此方法的研究 Bootstrap:方法是一类非参数Monte Carlo方法,其通过再抽样对总体分 布进行估计.再抽样方法将观测到的样本视为一个有限总体,从中进行随 机(再)抽样来估计总体的特征以及对抽样总体作出统计推断.当目标总体分布 没有指定时,Bootstrap方法经常被使用,此时,样本是唯一已有的信总 Bootstrap一词可以指非参数Bootstrap,.也可以指参数Bootstrap(上一讲 中).参数Bootstrap是指总体分布完全已知,利用Monte Carlo方法从此总体 中抽样进行统计推断;而非参数Bootstrap是指总体分布完全未知,利用再抽样 Previous Next First Last Back Forward 1

Chapter 1 Bootstrap and Jackknife 1.1 The Bootstrap Efron 31979,1981⁄1982cÛä•⁄\⁄?ò⁄u– Bootstarpê{, d ￾uL å˛'u dê{Ôƒ. Bootstrapê{¥òaöÎÍMonte Carloê{, ŸœL2ƒÈoN© Ÿ?1O. 2ƒê{Ú *ˇ¿èòákÅoN, l•?1ë Å(2)ƒ5OoNA±9ȃoNä—⁄Ỏ. 8IoN©Ÿ vkç½û, Bootstrapê{²~¶^, dû, ¥çòÆk&E. Bootstrap òcå±çöÎÍBootstrap, èå±çÎÍBootstrap(˛ò˘ •). ÎÍBootstrap¥çoN©Ÿ Æ, |^Monte Carloê{ldoN •ƒ?1⁄Ỏ; öÎÍBootstrap¥çoN©Ÿô, |^2ƒ Previous Next First Last Back Forward 1

方法从样本中(再)抽样进行统计推断 可以视样本所表示的有限总体的分布为一个”伪”总体,其具有和真实总体 类似的特征.通过从此”伪”总体中重复(再)抽样,可以据此估计统计量的抽样 分布.统计量的一些性质,如偏差,标准差等也可以通过再抽样来估计。 一个抽样分布的Bootstrap估计类似于密度估计的想法.我们通过一个样本 的直方图来估计密度函数的形状.直方图不是密度,但是在非参数问题中,可 以被视为是密度的一个合理估计.我们有很多方法从已知的密度中产生随机样 本,Bootstrap!则从经验分布中产生随机样本.假设c=(x1,·,xm)为一个从 总体分布F(x)中观测到得样本,X*为从x中随机选择的一个样本,则 P(K=)=i=1,…,n 从x中有放回的再抽样得到随机样本X货,·,X行.显然随机变量X,·,X 为i.i.d的随机变量,服从{x1,·,xn}上的均匀分布. 经验分布函数Fn(x)是F(x)的估计,可以证明,F(x)是F(x)的充分统计 量.而且另一方面,Fn(x)本身是{x1,·,xm}上的均匀分布随机变量X*的分 Previous Next First Last Back Forward 2

ê{l•(2)ƒ?1⁄Ỏ. 屿§L´kÅoN©Ÿèòá”ñ”oN, Ÿ‰k⁄˝¢oN aqA. œLld”ñ”oN• ­E(2)ƒ, 层dO⁄O˛ƒ ©Ÿ. ⁄O˛ò 5ü, X† , IO è屜L2ƒ5O. òჩŸBootstrapOaquó›Oé{. ·ÇœLòá Üê„5Oó›ºÍ/G. Üê„ ÿ¥ó›, ¥3öÎÍØK•, å ±¿è¥ó›òá‹nO. ·ÇkÈıê{lÆó›•)ëÅ , BootstrapKl²©Ÿ•)ëÅ. bx = (x1, · · · , xn)èòál oN©ŸF(x)•*ˇ, X∗èlx•ëÅ¿Jòá, K P(X∗ = xi) = 1 n , i = 1, · · · , n. lx•kò£2ƒëÅX∗ 1 , · · · , X∗ n. w,ëÅC˛X∗ 1 , · · · , X∗ n è i.i.dëÅC˛, —l{x1, · · · , xn}˛˛!©Ÿ. ²©ŸºÍFn(x)¥F(x)O, å±y², Fn(x)¥F(x)ø©⁄O ˛. Ö,òê°, Fn(x) ¥{x1, · · · , xn}˛˛!©ŸëÅC˛X∗© Previous Next First Last Back Forward 2

布函数.因此在Bootstrap中有这个逼近.Fn逼近到F,Bootstrap.重复下的经 验分布函数F是F的逼近.从x中再抽样,等价于从F中产生随机样本.这两 种逼近可以表示为 F→X+Fn Fn→X*→F 从x中产生一个Bootstrap随机样本可以这样实现,先从{1,2,·,n}中有 放回的选取n次得到{i1,…,in,然后得到Bootstrap样本x*=(x1,,,xn)为 假设0是我们感兴趣的参数(向量),为0的估计.则的分布的Bootstrap估 计可以通过如下方法得到 Previous Next First Last Back Forward 3

ŸºÍ. œd3Bootstrap•k˘á%C. Fn%CF, Bootstrap­Ee² ©ŸºÍF ∗ n¥Fn%C. lx•2ƒ,dulFn•)ëÅ. ˘¸ ´ %Cå±L´è F → X → Fn Fn → X∗ → F ∗ n lx•)òáBootstrapëÅå±˘¢y, kl{1, 2, · · · , n}•k ò£¿ng {i1, · · · , in}, ,￾Bootstrapx ∗ = (xi1 , · · · , xin ). bθ¥·Ça,ÎÍ(ï˛), θˆèθO. Kθˆ©ŸBootstrap  O屜LXeê{ Previous Next First Last Back Forward 3

1.对Bootstrap重复的第b次(b=1,·,B), (a)通过有放回的从x1,·,xn中抽样得到再抽样样 本x*(6)=xi,,x壳 (b)根据x*(b)计算(6). 2.Fa)的Bootstrap估计为1),.,B)的经验分布函数. 例1Fn与Bootstrap抽样假设我们观察到样本 x={2,2,1,1.5,4,4,3.1,2} 从x中再抽样依照选择1,2,3.4,5的概率分别为0.3,0.3,0.1,0.2,0.1进行.从而 Previous Next First Last Back Forward 4

1. ÈBootstrap­E1bg(b = 1, . . . , B), (a) œLkò£lx1, · · · , xn•ƒ2ƒ x ∗(b) = x ∗ 1 , . . . , x∗ n. (b) ä‚x ∗(b)Oéθˆ(b) . 2. Fθˆ(·)BootstrapOèθˆ(1) , . . . , θˆ(B)²©ŸºÍ. ~1 FnÜBootstrapƒ b·Ç*  x = {2, 2, 1, 1, 5, 4, 4, 3, 1, 2} lx•2ƒùÏ¿J1, 2, 3, 4, 5V«©Oè0.3, 0.3, 0.1, 0.2, 0.1?1. l Previous Next First Last Back Forward 4

从x中随机选择的一个样本X*,其分布函数就是经验分布函数,即 0, x<1: 0.3 1≤x<2: 0.6 Fx+(x)=Fn(Z)= 2≤x<3: 0.7,3≤x<4: 0.9,4≤x<5: 1, x25. 注意如果F没有靠近Fx,则重复抽样下的分布也不会靠近Fx.上例中 的样本x实际上是从Poisson(2)中随机产生的,从x中大量重复抽样可以很好 的估计F,但是不能很好的估计Fx,因为无论重复多少次再抽样,得到的 Bootstrap样本都没有O. 1.1.1 Bootstrap Estimation of Standard Error 估计量的标准差的Bootstrap估计,是Bootstrap重复1),..,B)的样本标 准差: B 驼B(*)=1 B-1 Previous Next First Last Back Forward 5

lx•ëÅ¿J òáX∗, Ÿ©ŸºÍ“¥²©ŸºÍ, = FX∗ (x) = Fn(x) =    0, x < 1; 0.3, 1 ≤ x < 2; 0.6, 2 ≤ x < 3; 0.7, 3 ≤ x < 4; 0.9, 4 ≤ x < 5; 1, x ≥ 5. 5øXJFnvkÇCFX, K­Eƒe©Ÿèÿ¨ÇCFX. ˛~• x¢S˛¥lP oisson(2)•ëÅ), lx•å˛­Eƒå±È– OFn, ¥ÿUÈ–OFX, œèÃÿ­Eıg2ƒ,  Bootstrap—vk0. 1.1.1 Bootstrap Estimation of Standard Error O˛θˆIO BootstrapO, ¥Bootstrap­Eθˆ(1) , . . . , θˆ(B) I O : seˆ B(θˆ∗ ) = vuut 1 B − 1 XB b=1 (θˆ(b) − θˆ∗) 2. Previous Next First Last Back Forward 5

其中0=言∑B1b). 根据Eron和Tibshirini(1993),要得到标准差一个好的估计,重复的次 数B并非需要非常大.B=50常常已经足够了,B>200是很少见的(置信区间 除外) 例2(标准差的Bootstrap估计)bootstrap包里的法律院校数据集law,记 录了15所法律院校入学考试的平均成绩(LSAT)和GPA(乘了100) 123456789101112131415 LSAT576635558578666580555661651605653575545572594 GPA339330281303344307300343336313312274276288296 估计LSAT和GPA之间的相关系数,并求样本相关系数的标准差的Bootstrap估 计 在本例中 1.数据是成对的(x,h),i=1,,15. Previous Next First Last Back Forward 6

Ÿ•θˆ∗ = 1 B PB b=1 θˆ(b) . ä‚Efron⁄Tibshirini(1993), áIO òá–O, ­Eg ÍBøöIáö~å. B = 50~~Ʋv , B > 200¥ÈÑ(ò&´m ÿ ). ~2 (IO BootstrapO) bootstrapùp{ÆÍ‚8law, P ¹ 15§{Æ\Æ£²˛§1(LSAT)⁄GPA(¶ 100). 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 LSAT 576 635 558 578 666 580 555 661 651 605 653 575 545 572 594 GPA 339 330 281 303 344 307 300 343 336 313 312 274 276 288 296 OLSAT⁄GPAÉmÉ'XÍ, ø¶É'XÍIO Bootstrap O. 3~• 1. Í‚¥§È(xi, yi), i = 1, . . . , 15. Previous Next First Last Back Forward 6

2.可以通过样本相关系数估计相关系数 n∑ix-∑:c:∑i班 Vn∑x-(∑:x)2√n∑i-(∑:)2 3.Bootstrap对这些数据对再抽样」 因此,算法如下 1.对Bootstrap重复的第b次(b=1,.·,B), (a)通过有放回的从x1,·,xn中抽样得到再抽样样本 x*(⑥)=xi,,x元.这里x:或者x为一个向量. (b)根据x*()计算(b) 2.F()的Bootstrap即估计为(1),,(B)的经验分布函 数 样本相关系数为cor(LSAT,GPA)=0.7763745,使用Bootstrap估计标准 差的程序如下: Previous Next First Last Back Forward 7

2. 屜LÉ'XÍOÉ'XÍ τˆ = n P i xiyi − P i xi P i yi q n P i x 2 i − ( P i xi) 2 q n P i y 2 i − ( P i yi) 2 . 3. BootstrapÈ˘ Í‚È2ƒ. œd, é{Xe 1. ÈBootstrap­E1bg(b = 1, . . . , B), (a) œLkò£lx1, · · · , xn•ƒ2ƒ x ∗(b) = x ∗ 1 , . . . , x∗ n. ˘pxi½ˆx ∗ i èòáï˛. (b) ä‚x ∗(b)Oéτˆ (b) . 2. Fτˆ(·)BootstrapOèτˆ (1) , . . . , τˆ (B)²©Ÿº Í. É'XÍècor(LSAT, GP A) = 0.7763745, ¶^BootstrapOIO ßSXe: Previous Next First Last Back Forward 7

library(bootstrap) #for the law data print (cor(law$LSAT,law$GPA)) #set up the bootstrap B<-200 #number of replicates n <-nrow(law) #sample size R <-numeric(B) #storage for replicates #bootstrap estimate of standard error of R for (b in 1:B){ #randomly select the indices i <-sample(1:n,size n,replace TRUE) LSAT <law$LSAT[i] #i is a vector of indices GPA <law$GPA[i] R[b]<cor(LSAT,GPA) } #output print(se.R <sd(R)) hist(R,prob TRUE) Code se()的Bootstrap估计为0.1371913,样本相关系数的标准差的理论值 Previous Next First Last Back Forward 8

↑Code library(bootstrap) #for the law data print(cor(law$LSAT, law$GPA)) #set up the bootstrap B <- 200 #number of replicates n <- nrow(law) #sample size R <- numeric(B) #storage for replicates #bootstrap estimate of standard error of R for (b in 1:B) { #randomly select the indices i <- sample(1:n, size = n, replace = TRUE) LSAT <- law$LSAT[i] #i is a vector of indices GPA <- law$GPA[i] R[b] <- cor(LSAT, GPA) } #output print(se.R <- sd(R)) hist(R, prob = TRUE) ↓Code se(ˆτ)BootstrapOè0.1371913, É'XÍIO nÿä Previous Next First Last Back Forward 8

点击下载完整版文档(PDF)VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
共49页,可试读17页,点击继续阅读 ↓↓
相关文档

关于我们|帮助中心|下载说明|相关软件|意见反馈|联系我们

Copyright © 2008-现在 cucdc.com 高等教育资讯网 版权所有