rambo

Bootstrap

BootStrap(自助法):一种有返还的再抽样统计方法,可以用于总体分布未知或统计量的分布未知时的参数推断。再抽样过程可以不依赖于某些经典统计推断假设,如抽样分布的正态性和中心极限定律,而用来计算检验统计量的P值或置信区间的上、下限。

典故:术语“Bootstrap”来自短语“to pull oneself up by one’s bootstraps” (源自西方神话故事“ The Adventures of Baron Munchausen”,男爵掉到了深湖底,没有工具,所以他想到了拎着鞋带将自己提起来)

  • 计算机的引导程序boot也来源于此
  • 意义:不靠外界力量,而靠自身提升自己的性能,翻译为自助/自举

许多经典统计方法是建立在对样本观察值所在总体进行多种假设基础上的。例如,如果样本呈正态分布,计算

QQ截图20150904163513

该t值将服从一个自由度为n_{1}+n_{2}-2的t分布。然而,在许多情况下,样本观测值是偏离正态分布的活着观测值的分布根本不知道。因此基于正态分布假设的经典统计推断结果便不可靠甚至可能错误。

基本思路:利用样本数据计算统计量和估计样本分布,而不对模型做任何假设(非参数bootstrap)

如果不知道总体分布,那么对总体分布的最好猜测便是由数据提供的分布。

  • 假定观测值便是总体
  • 由这一假定的总体有放回的再抽样样本,由原始数据经过再抽样所获得的与原始数据集含量相等的样本称为再抽样样本(resamples)或自助样本(bootstrap samples)
  • 由原始数据集计算所得的统计量称为观察统计量(observed statistic);由再抽样样本计算所得的统计量称为自助统计量(bootstrap statistic)。其中,“∷”表示二者间的关系,“<=> ”表示等价于。也就是说,通过对自助统计量的研究,就可以了解有关观察统计量与真值的偏离情况。

QQ截图20150904164657

假设原始数据集包含N个观测值X =[x_{1}, .. x_{n}],根据有限的观测值可以推测出产生这些数据的模型并找到最优的参数,但是无法知道模型和参数多大程度上可信。因为观测值x通常包含噪声,同时会有一些影响因素没有被纳入模型的考虑范围。

QQ截图20150904165156

Bootstrap方法通过创造多个“pseudo dataset”来给出模型及参数的可信程度方法如下:

原始数据集包含N个观测值Z=[z_{1}, ..z_{N}],其中z_{i}=(x_{i},y_{i})

  • 从Z中有放回地抽出N个点构成第一数据集 Z^{*}_{r1}
  • 从Z中有放回地抽出N个点构成第二数据集Z^{*}_{r2}
  • ...
  • 从Z中有放回地抽出N个点构成第m数据集Z^{*}_{rb}

(显然,Z中的点有些重复出现在Z_{r1}中,有些点没有出现在Z_{r1}中)

  • 在第1数据集Z^{*}_{r1}上训练出模型M_{1}的一组参数
  • 在第2数据集 Z^{*}_{r2}上训练出模型M_{2}的一组参数
  • ...
  • 在第m数据集Z^{*}_{rb}上训练出模型M_{B}的一组参数

在一个bootstrap样本集中不包含某个原始样本z_{i}的概率为(1-\frac{1}{n})^{n}=e,n->\infty

一个bootstrap样本集包含了大约原始样本集的1-0.368 = 0.632,另外0.368的样本没有包括。

QQ截图20150904214015

比较不同参数作出的预测的variability(方差,可以理解为波动范围大小),在不同样本上训练出来的模型差异越大可信度越小。Efron将这一置信区间估计方法命名为Bootstrap,其含义是不依靠额外的验证数据集(validation dataset), 仅使用自身的原始数据集,给出自身的可信度。

作为一种再抽样方法,自助法由原始数据集重复抽取样本,然后计算一些统计量s(x^{*})的值,并用这些数值对一些未知参数的真值做出推断。那么,就某一统计量而言,到底需要多少自助重复呢?然而,当估计置信区间和进行假设检验时,大致需要2 000个自助样本。考虑到目前计算机效率已不是很大的制约因素,建议自助样本数可以为1 000~100 000不等。

QQ截图20150904230750

 Bootstrap Estimate of Mean

将B个自助样本的均数进行平均便得到自助样本均数,用此代表总体均数。令s(x^{*i})为第i个自助样本集的均数,i=1,2,...,Bs^{(0)}为自助样本均数,则

s^{(0)}=\sum_{i=1}^{B}s(x^{*i})/B

 Bootstrap Estimate of Standard Error

使用bootstrap估计\hat{\theta}=\frac{1}{N}\sum_{i=1}^{N}(x_{i}-\bar{x})^{2}的标准差。

QQ截图20150904222429 QQ截图20150904222450

注意,这里计算的是一组(B个)均数的标准差,即均数的标准误差。因此,不要根据常规计算标准误差的方法再用\sqrt{B}去除这一标准差。

Efron(1987)给出一个公式以检验不同样本数的效应,并根据他们的经验指出,若估计偏差和方差,通常B=200即可;当B=50时便能提供一些有用的信息。

偏度用来衡量分布的不对称程度或偏斜成都。随机变量的偏度是变量的三阶中心矩除以标准差的三次方(n/ (n-1)(n-2)再乘以(样本与均值的偏差的立方和/样本标准差的立方))。

p_{d}=\frac{n^{2}u_{3}}{(n-1)(n-2)s^{3}}

正态分布的偏度为零,若p_{d}<0称分布具有负偏离,也称左偏态,此时数据位于均值右边的比位于左边的多;若p_{d}>0,呈分布具有正偏离,也称右偏态。当偏度接近0时,可认为分布是对称的。若知道分布有可能在偏度上偏离正态分布时 ,可用偏离来检测分布的正态性。

Bootstrap Estimate of Bias

Bias is defined as the difference between the expected value of the statistic and the parameter:

bias(T)=E[T]-\theta

QQ截图20150904232910 QQ截图20150904222450

The bias-corrected estimator:
QQ截图20150904231924 QQ截图20150904231956

上式会产生一个less-biased的估计,但是\tilde{\theta}具有更大的方差或标准差。如果估计得到的偏差相比标准差小的多,那么就不要采用这个修正公式。

More bootstrap samples are needed to estimate the bias, than are required to estimate the standard error.Efron(1987) 推荐B\ge 400

QQ截图20150904232814

Bootstrap Estimate of Confidence Intervals

1)the standard interval

假设检验中的(1-\alpha)100%置信区间

QQ截图20150904234626 QQ截图20150904234638 QQ截图20150904234811 QQ截图20150904234919 QQ截图20150904234937 QQ截图20150904235246 QQ截图20150904235215QQ截图20150904235302
QQ截图20150904234854

QQ截图20150904234031

Bootstrap标准置信区间可由下式求得:

QQ截图20150904235944

其中SE_{hat{\theta}} is the standard error for the statistic \hat{\theta} obtained using the bootstrap [Mooney and Duval, 1993].

上式可用于当\hat{\theta}为正态分布或正态假设时。

2)the bootstrap-t interval
QQ截图20150905000329
注意观察上式,\hat{SE^{*b}}为重抽样集\hat{\theta^{*b}}的估计标准差。那么,当我们放回重采样一个数据集时可以得到\hat{SE^{*b}}的一个估计。那么我们可以得到B\hat{SE^{*b}}的bootstrap估计。

QQ截图20150905000915

6.23式说明估计的分位数(quantile)为\hat{t^{(\alpha/2)}}使得100\cdot\alpha/2%的点z^{*b}将小于该数目。比如,B=100\alpha/2=0.05,那么\hat{t^{(0.05)}}将被估计为z^{*b}第五大的值。(B\cdot\alpha/2=100\cdot 0.05=5)

QQ截图20150905001501

where hat{SE} is an estimate of the standard error of \hat{\theta} .

QQ截图20150905001703

注意,如果无法计算\hat{\theta}^{*b}的标准差公式,那么需要采用Bootstrap方法,即意味着有两成bootstrapping:一个用来计算\hat{SE}^{*b},一个用来计算z^{*b}。比如B=1000,采用50个bootstrap重采样集来寻找算\hat{SE}^{*b},那么总共需要50000次重采样。

例子:估计forearm数据集的方差\hat{\delta}^{2}=\frac{1}{n}\sum_{i=1}^{N}(x_{i}-\bar{x})^{2}即二阶中心矩。

3)the percentile method

QQ截图20150905004329

QQ截图20150905004518

置信区间为(1.03, 1.45),相对于第二种方法置信区间较窄。

讨论:

  • The standard interval is the easiest and assumes that \hat{\theta} is normally distributed.
  • The bootstrap-t interval estimates the standardized version of \tilde{\theta} from the data, avoiding the normality assumptions used in the standard interval.
  • The per-centile interval is simple to calculate and obtains the endpoints directly from the bootstrap estimate of the distribution for \hat{\theta}  . It has another advantage in that it is range-preserving. This means that if the parameter \theta can take on values in a certain range, then the confidence interval will reflect that. This is not always the case with the other intervals.

According to Efron and Tibshirani [1993], the bootstrap-t interval has good coverage probabilities, but does not perform well in practice. The bootstrap percentile interval is more dependable in most situations, but does not enjoy the good coverage property of the bootstrap-t interval. There is another boot-strap confidence interval, called the BCa interval, that has both good cover-age and is dependable. This interval is described in the next chapter.

附录