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. ÈBootstrapE1bg(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, KEƒ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˛θˆIOBootstrapO, ¥BootstrapEθˆ(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 (IOBootstrapO) 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ÍIOBootstrap 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. ÈBootstrapE1bg(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ÍIOnÿä Previous Next First Last Back Forward 8