一般地,我们想要研究总体 P P P,我们对参数 θ \theta θ非常感兴趣,但是这是一个未知的值,我们只能通过样本来估计它。我们如何利用样本来估计它呢?
我们先用一个比较具体的例子,统计人的好伙伴——均值。
比如我们想要估计总体的均值 μ \mu μ,假设我们任意抽的样本为 X = ( x 1 , x 2 , . . . , x n ) X=(x_1, x_2, ..., x_n) X=(x1,x2,...,xn),我们就通过统计量 s = s ( x 1 , . . . x n ) = 1 n ∑ i = 1 n x i s=s(x_1,...x_n)=\frac{1}{n} \sum_{i=1}^n x_i s=s(x1,...xn)=n1∑i=1nxi来估计 μ \mu μ。
我们抽样得到了多组样本 X 1 , X 2 , . . . X m X_1,X_2,...X_m X1,X2,...Xm( X i = ( x i 1 , x i 2 , . . . , x i n ) X_i=(x_{i1},x_{i2}, ..., x_{in}) Xi=(xi1,xi2,...,xin)),每组样本都可以计算出统计量 s s s的值,一共有 m m m组样本,那么我们就可以算出 m m m个统计量 s s s的值。
使 用 样 本 X 1 : s 1 = s ( x 11 , . . . , x 1 n ) = 1 n ∑ j = 1 n x 1 j 使用样本X_1:s_1 = s(x_{11},...,x_{1n})=\frac{1}{n}\sum_{j=1}^n x_{1j} 使用样本X1:s1=s(x11,...,x1n)=n1j=1∑nx1j
使 用 样 本 X 2 : s 2 = s ( x 21 , . . . , x 2 n ) = 1 n ∑ j = 1 n x 2 j 使用样本X_2:s_2 = s(x_{21},...,x_{2n})=\frac{1}{n}\sum_{j=1}^n x_{2j} 使用样本X2:s2=s(x21,...,x2n)=n1j=1∑nx2j
. . . . . . ...... ......
使 用 样 本 X m : s m = s ( x m 1 , . . . , x m n ) = 1 n ∑ j = 1 n x m j 使用样本X_m:s_m = s(x_{m1},...,x_{mn})=\frac{1}{n}\sum_{j=1}^n x_{mj} 使用样本Xm:sm=s(xm1,...,xmn)=n1j=1∑nxmj
每一个 s i ( i = 1 , . . . , m ) s_i(i=1,...,m) si(i=1,...,m)都可以用来反映 μ \mu μ的大小,我们究竟应该听谁的呢?我们选择综合每个样本的意见,使用 s ˉ = 1 m ∑ i = 1 m s i \bar s = \frac{1}{m} \sum_{i=1}^m s_i sˉ=m1∑i=1msi来反映 μ \mu μ的大小。
比如我们想要估计总体的参数 θ \theta θ(比如均值、方差、中位数等等),假设我们任意抽的样本为 X = ( x 1 , x 2 , . . . , x n ) X=(x_1, x_2, ..., x_n) X=(x1,x2,...,xn),我们就通过统计量 s = s ( x 1 , . . . x n ) s=s(x_1,...x_n) s=s(x1,...xn)来估计 θ \theta θ。
我们抽样得到了多组样本 X 1 , X 2 , . . . X m X_1,X_2,...X_m X1,X2,...Xm( X i = ( x i 1 , x i 2 , . . . , x i n ) X_i=(x_{i1},x_{i2}, ..., x_{in}) Xi=(xi1,xi2,...,xin)),每组样本都可以计算出统计量 s s s的值,一共有 m m m组样本,那么我们就可以算出 m m m个统计量 s s s的值。
使 用 样 本 X 1 : s 1 = s ( x 11 , . . . , x 1 n ) 使用样本X_1:s_1 = s(x_{11},...,x_{1n}) 使用样本X1:s1=s(x11,...,x1n)
使 用 样 本 X 2 : s 2 = s ( x 21 , . . . , x 2 n ) 使用样本X_2:s_2 = s(x_{21},...,x_{2n}) 使用样本X2:s2=s(x21,...,x2n)
. . . . . . ...... ......
使 用 样 本 X m : s m = s ( x m 1 , . . . , x m n ) 使用样本X_m:s_m = s(x_{m1},...,x_{mn}) 使用样本Xm:sm=s(xm1,...,xmn)
每一个 s i ( i = 1 , . . . , m ) s_i(i=1,...,m) si(i=1,...,m)都可以用来反映 θ \theta θ的大小,我们究竟应该听谁的呢?我们选择综合每个样本的意见,使用 s ˉ = 1 m ∑ i = 1 m s i \bar s = \frac{1}{m} \sum_{i=1}^m s_i sˉ=m1∑i=1msi来反映 θ \theta θ的大小。
上面是一般情况下也是理想情况下的操作,但现实总是很魔幻,那就是下面的事情了。
我们使用 s ˉ \bar s sˉ来估计总体参数 θ \theta θ,这种估计好不好呢?可能我们从构造了一个不好的统计量,那么这个统计量对参数的估计效果可能就很差。所以我们还需要考察构造的统计量 s s s的好坏。这样我们就需要用到偏差和标准误差。
偏 差 : b i a s = E ( s ) − θ 偏差:bias = E(s) - \theta 偏差:bias=E(s)−θ
标 准 误 差 : s e = s 标 准 差 n 标准误差:se = \frac{s_{标准差}}{\sqrt{n}} 标准误差:se=ns标准差
(仅仅 s 标 准 差 s_{标准差} s标准差代表标准差,其他所有的 s s s代表统计量,不好意思我第一次写的时候没有意识到我要用两个 s s s,这里声明一下)
假设我们现在想要研究的总体目标 P P P非常特殊,是得一种很稀有的病的人,可能几万个人才有1个得病的,这个人群非常稀少,我们很难获得大量的样本,就算可以获得一定的样本,也很难重复抽样。但是我们依然希望能够估计总体的参数 θ \theta θ,我们依然用统计量 s s s去估计总体参数 θ \theta θ,并且还要评价这种估计的好坏,那么现在会面临什么样的问题呢?
我们现在面临的问题
我们现在只能怎么做呢?
只能通过仅有的一个样本 X = ( x 1 , x 2 , . . . , x n ) X=(x_1, x_2, ..., x_n) X=(x1,x2,...,xn)去估计统计量 s s s的一个值,然后仅仅根据这一个值来估计总体参数 θ \theta θ。
这样做可以吗
可以,但是不好。为什么不好呢?因为只用一个数去估计总体参数的话方差会很大,会非常不精确。那怎么办呢?我们可以借助Jackknife的方法。
有点类似于机器学习中的leave-one-out思想:
我们不是只有一个样本 X = ( x 1 , x 2 , . . . , x n ) X=(x_1, x_2, ..., x_n) X=(x1,x2,...,xn)吗?现在我们希望能够得到多个样本,但是又没办法重复抽样得到多个样本了,我们就只能利用已有的样本 X X X,通过它来重复产生样本。
很简单,我们每次剔除 X X X中的一个值就可以产生一个样本,这样我们一共可以产生 n n n个样本。第 i i i个样本为:
X ( i ) = ( x 1 , . . . , x i − 1 , x i + 1 , . . . , x n ) X_{(i)} = (x_1, ..., x_{i-1}, x_{i+1}, ..., x_n) X(i)=(x1,...,xi−1,xi+1,...,xn)
于是我们得到了新的 n n n个样本 X ( 1 ) , . . . , X ( n ) X_{(1)},...,X_{(n)} X(1),...,X(n),我们通过这 n n n个样本计算出统计量 s s s的 n n n个值,通过 s ˉ \bar s sˉ来估计总体参数 θ \theta θ。最后我们还要考察统计量 s s s好不好。
以下记统计量为 θ ^ \hat \theta θ^。
记 θ ^ ( i ) = θ ^ ( x 1 , . . . , x i − 1 , x i + 1 , . . . , x n ) \hat \theta_{(i)} = \hat \theta(x_{1}, ..., x_{i-1}, x_{i+1}, ..., x_n) θ^(i)=θ^(x1,...,xi−1,xi+1,...,xn),是代入样本 X ( i ) X_{(i)} X(i)后算出来统计量 θ ^ \hat \theta θ^的值,每个值都可以反映 θ \theta θ的大小。我们再将每次算出的值进行平均,构造出新的统计量 θ ^ ( . ) {\hat {\theta}}_{(.)} θ^(.):
θ ^ ( . ) = 1 n ∑ i = 1 n θ ^ ( i ) {\hat {\theta}}_{(.)} = \frac{1}{n} \sum_{i=1}^{n} \hat \theta_{(i)} θ^(.)=n1i=1∑nθ^(i)
我们使用 θ ^ ( . ) {\hat {\theta}}_{(.)} θ^(.)来估计总体参数 θ \theta θ。
下面我们来考察统计量 θ ^ ( . ) {\hat {\theta}}_{(.)} θ^(.)的好坏,衡量统计量好坏的指标有很多,这里我们选择的是【偏差】和【标准误差】。
以总体方差 θ = σ 2 \theta = \sigma^2 θ=σ2为例,我们构造了统计量 θ ^ = σ ^ 2 = 1 n ∑ i = 1 n ( x i − x ˉ ) 2 \hat \theta = \hat \sigma^2 = \frac{1}{n}\sum_{i=1}^n (x_i - \bar x)^2 θ^=σ^2=n1∑i=1n(xi−xˉ)2,我们想知道这个统计量 θ ^ \hat \theta θ^是否无偏,我们可以考察统计量 θ ^ \hat \theta θ^的偏差 b i a s ( θ ^ ) bias(\hat \theta) bias(θ^)(是一个未知的数):
b i a s ( θ ^ ) = E ( θ ^ ) − θ bias(\hat \theta) = E(\hat \theta) - \theta bias(θ^)=E(θ^)−θ
如果偏差 b i a s ( θ ^ ) = 0 bias(\hat \theta)=0 bias(θ^)=0,说明统计量 θ ^ \hat \theta θ^无偏。但是偏差 b i a s ( θ ^ ) = 0 bias(\hat \theta)=0 bias(θ^)=0是一个未知的数,我们只能通过构造统计量 b i a s ( θ ^ ) ^ \hat {bias(\hat \theta)} bias(θ^)^去估计 θ ^ \hat \theta θ^,构造方法如下:
但是我们只有一个样本 X = ( x 1 , . . . , x n ) X = (x_1, ..., x_n) X=(x1,...,xn),只能计算一个 θ ^ \hat \theta θ^的值,无法得到样本均值 E ^ ( θ ^ ) \hat E(\hat \theta) E^(θ^)。怎么办呢?我们使用Jackknife方法构造出新的n个样本 X ( 1 ) , . . . , X ( n ) X_{(1)},...,X_{(n)} X(1),...,X(n),这样就可以得到多个 θ ^ \hat \theta θ^的值,从而计算除 E ^ ( θ ^ ) \hat E(\hat \theta) E^(θ^)了。
E ^ ( θ ^ ) = 1 n ∑ i = 1 n θ ^ ( i ) = θ ^ ( . ) \hat E(\hat \theta) = \frac{1}{n} \sum_{i=1}^{n} \hat \theta_{(i)} = \hat \theta_{(.)} E^(θ^)=n1i=1∑nθ^(i)=θ^(.)
b i a s ( θ ^ ) ^ = E ^ ( θ ^ ) − θ ^ = θ ^ ( . ) − θ ^ \hat {bias(\hat \theta)} = \hat E(\hat \theta) - \hat \theta= \hat \theta_{(.)} - \hat \theta bias(θ^)^=E^(θ^)−θ^=θ^(.)−θ^
其中:
θ ^ ( i ) = θ ^ ( X ( i ) ) \hat \theta_{(i)} = \hat \theta(X_{(i)}) θ^(i)=θ^(X(i))
θ ^ = θ ^ ( X ) \hat \theta = \hat \theta(X) θ^=θ^(X)
我们本意是查看统计量 θ ^ \hat \theta θ^的好坏,我们通过偏差 b i a s bias bias这个指标来衡量 θ ^ \hat \theta θ^的好坏。但是由于 b i a s bias bias是一个未知的数,我们只能通过构造统计量去估计它,于是我们构造出了 b i a s bias bias的统计量 b i a s ^ \hat {bias} bias^。我们构造出的这个统计量可能好可能不好,下面我们来计算统计量 b i a s ^ \hat {bias} bias^的期望(如果无偏则统计量 b i a s ^ \hat {bias} bias^好):
E ( b i a s ( θ ^ ) ^ ) = E ( θ ^ ( . ) − θ ^ ) = E ( θ ^ ( . ) − θ ) + E ( θ − θ ^ ) = b i a s ( θ ^ ( . ) ) − b i a s ( θ ^ ) = − σ 2 n − 1 − ( − σ 2 n ) = − 1 n ( n − 1 ) σ 2 \begin{aligned} E(\hat {bias(\hat \theta)}) &= E(\hat \theta_{(.)} - \hat \theta) \\ &= E(\hat \theta_{(.)} - \theta) + E(\theta - \hat \theta) \\ &= bias(\hat \theta_{(.)}) - bias(\hat \theta)\\ &= -\frac{\sigma^2}{n-1} - (- \frac{\sigma^2}{n}) \\ &= -\frac{1}{n(n-1)} \sigma^2 \end{aligned} E(bias(θ^)^)=E(θ^(.)−θ^)=E(θ^(.)−θ)+E(θ−θ^)=bias(θ^(.))−bias(θ^)=−n−1σ2−(−nσ2)=−n(n−1)1σ2
「 对上式倒数第二行的证明(回想一下 θ ^ \hat \theta θ^是什么,是 σ ^ 2 \hat \sigma^2 σ^2;回想一下 σ ^ 2 \hat \sigma^2 σ^2是什么,是 1 n ∑ i = 1 n ( x i − x ˉ ) 2 \frac{1}{n}\sum_{i=1}^n (x_i - \bar x)^2 n1∑i=1n(xi−xˉ)2,回想一下 x i x_i xi是什么…… ):
b i a s ( θ ^ ) = E ( σ ^ 2 − σ 2 ) = E ( 1 n ∑ i = 1 n ( x i − x ˉ ) 2 ) − σ 2 = − 1 n σ 2 \begin{aligned} bias(\hat \theta) &= E(\hat \sigma^2 - \sigma^2) \\ &= E(\frac{1}{n}\sum_{i=1}^n (x_i - \bar x) ^2) - \sigma^2 \\ &= -\frac{1}{n} \sigma^2 \end{aligned} bias(θ^)=E(σ^2−σ2)=E(n1i=1∑n(xi−xˉ)2)−σ2=−n1σ2
因为 θ ^ \hat \theta θ^用了n个数据, θ ^ ( i ) \hat \theta_{(i)} θ^(i)只用了n-1个数据,于是:
b i a s ( θ ^ ( i ) ) = E ( θ ^ ( i ) − θ ) = − 1 n − 1 σ 2 bias(\hat \theta_{(i)}) = E(\hat \theta_{(i)} - \theta) = -\frac{1}{n-1} \sigma^2 bias(θ^(i))=E(θ^(i)−θ)=−n−11σ2」
这样就说明,用 b i a s ( θ ^ ) ^ \hat {bias(\hat \theta)} bias(θ^)^来估计 b i a s ( θ ^ ) {bias(\hat \theta)} bias(θ^)是有偏的,因为: E ( b i a s ( θ ^ ) ^ ) = 1 n − 1 b i a s ( θ ^ ) E(\hat {bias(\hat \theta)}) = \frac{1}{n-1}bias(\hat \theta) E(bias(θ^)^)=n−11bias(θ^)
但是只要我们稍作调整就可以得到 b i a s ( θ ^ ) bias(\hat \theta) bias(θ^)的无偏估计,构造:
b i a s ^ j a c k = ( n − 1 ) b i a s ^ ( θ ^ ) \hat {bias}_{jack} = (n-1)\hat {bias}(\hat \theta) bias^jack=(n−1)bias^(θ^)
则: E ( b i a s ^ j a c k ) = b i a s ( θ ^ ) E(\hat {bias}_{jack}) = bias(\hat \theta) E(bias^jack)=bias(θ^)
所以我们构造的 b i a s ^ j a c k \hat {bias}_{jack} bias^jack是 b i a s ( θ ^ ) {bias(\hat \theta)} bias(θ^)的无偏估计,这就是我们Jackknife对偏差的估计:
b i a s ^ j a c k = ( n − 1 ) ( θ ^ ( . ) − θ ^ ) \hat {bias}_{jack} = (n-1) (\hat \theta_{(.)} - \hat \theta) bias^jack=(n−1)(θ^(.)−θ^)
以总体均值 θ = μ \theta = \mu θ=μ为例,我们构造了统计量 θ ^ = x ˉ = ∑ i = 1 n x i \hat \theta = \bar x = \sum_{i=1}^n x_i θ^=xˉ=∑i=1nxi,我们想知道这个统计量 x ˉ \bar x xˉ的标准误差 s e ( θ ^ ) = s 标 准 差 n se(\hat \theta)=\frac{s_{标准差}}{\sqrt{n}} se(θ^)=ns标准差。
但是我们只有一个样本 X = ( x 1 , . . . , x n ) X = (x_1, ..., x_n) X=(x1,...,xn)。于是我们使用Jackknife方法构造出新的n个样本 X ( 1 ) , . . . , X ( n ) X_{(1)},...,X_{(n)} X(1),...,X(n),我们可以查看统计量的标准误差 s e ( θ ^ ) se(\hat \theta) se(θ^)(是一个数):
s e ( θ ^ ) = s 标 准 差 n = D 方 差 n = σ 2 n \begin{aligned} se(\hat \theta) &= \frac{s_{标准差}}{\sqrt{n}} \\ &=\sqrt{\frac{D_{方差}}{n}}\\ &= \sqrt{\frac{\sigma^2}{n}} \end{aligned} se(θ^)=ns标准差=nD方差=nσ2
我们使用统计量 s e ^ ( θ ^ ) j a c k \hat {se}(\hat \theta)_{jack} se^(θ^)jack来估计 s e ( θ ^ ) se(\hat \theta) se(θ^)(一个数),这个统计量最好是无偏估计的。由于一般而言 s e ^ \hat {se} se^都有根号,不方便算期望,于是我们用 s e ^ 2 \hat {se}^2 se^2来算。于是我们使用统计量 s e 2 ^ ( θ ^ ) j a c k \hat {se^2}(\hat \theta)_{jack} se2^(θ^)jack来估计 s e 2 ( θ ^ ) se^2(\hat \theta) se2(θ^)(一个数)。其中:
s e 2 ( θ ^ ) = σ 2 n se^2(\hat \theta) = {\frac{\sigma^2}{n}} se2(θ^)=nσ2
我们来基于下面式子 ( ∗ ) (*) (∗)来逐步构造 s e 2 ^ ( θ ^ ) j a c k \hat {se^2}(\hat \theta)_{jack} se2^(θ^)jack:
∑ i = 1 n ( θ ^ ( i ) − θ ^ ( . ) ) 2 (*) \sum_{i=1}^n (\hat \theta_{(i)} - \hat \theta_{(.)})^2 \tag{*} i=1∑n(θ^(i)−θ^(.))2(*)
我们需要 s e 2 ^ ( θ ^ ) j a c k \hat {se^2}(\hat \theta)_{jack} se2^(θ^)jack是 s e 2 ( θ ^ ) se^2(\hat \theta) se2(θ^)的无偏估计,于是我们来计算上面那个式子 ( ∗ ) (*) (∗)的期望,如果期望不等于 s e 2 ( θ ^ ) se^2(\hat \theta) se2(θ^),我们只需要乘以一个系数即可将它调整为无偏估计。
θ ^ ( i ) − θ ^ ( . ) = 1 n − 1 ∑ j ≠ i n x j − x ˉ = n x ˉ − x i n − 1 − x ˉ = x ˉ − x i n − 1 \begin{aligned} \hat \theta_{(i)} - \hat \theta_{(.)} &= \frac{1}{n-1}\sum_{j \neq i}^n x_j- \bar x \\ &= \frac{n\bar x - x_i}{n-1} - \bar x \\ &= \frac{\bar x - x_i}{n-1} \end{aligned} θ^(i)−θ^(.)=n−11j=i∑nxj−xˉ=n−1nxˉ−xi−xˉ=n−1xˉ−xi
于是:
E ( ∑ i = 1 n ( θ ^ ( i ) − θ ^ ( . ) ) 2 ) = E ( 1 ( n − 1 ) 2 ∑ i = 1 n ( x i − x ˉ ) 2 ) = 1 n − 1 σ 2 \begin{aligned} E(\sum_{i=1}^n (\hat \theta_{(i)}- \hat \theta_{(.)})^2) &= E(\frac{1}{(n-1)^2} \sum_{i=1}^n (x_i - \bar x)^2) \\ &= \frac{1}{n-1}\sigma^2 \end{aligned} E(i=1∑n(θ^(i)−θ^(.))2)=E((n−1)21i=1∑n(xi−xˉ)2)=n−11σ2
构造:
s e 2 ^ ( θ ^ ) j a c k = n − 1 n ∑ i = 1 n ( θ ^ ( i ) − θ ^ ( . ) ) 2 ) \begin{aligned} \hat {se^2}(\hat \theta)_{jack} &= \frac{n-1}{n} \sum_{i=1}^n (\hat \theta_{(i)}- \hat \theta_{(.)})^2) \end{aligned} se2^(θ^)jack=nn−1i=1∑n(θ^(i)−θ^(.))2)
E ( s e 2 ^ ( θ ^ ) j a c k ) = σ 2 n \begin{aligned} E(\hat {se^2}(\hat \theta)_{jack}) &= \frac{\sigma^2}{n} \end{aligned} E(se2^(θ^)jack)=nσ2
这样构造的 s e 2 ^ ( θ ^ ) j a c k \hat {se^2}(\hat \theta)_{jack} se2^(θ^)jack就是 s e 2 ( θ ^ ) {se^2}(\hat \theta) se2(θ^)的无偏估计。
所以我们使用 s e ^ 2 ( θ ^ ) j a c k \hat {se}^2(\hat \theta)_{jack} se^2(θ^)jack来估计 s e 2 {se}^2 se2,即用 s e ^ ( θ ^ ) j a c k \hat {se}(\hat \theta)_{jack} se^(θ^)jack来估计 s e ( θ ^ ) {se(\hat \theta)} se(θ^),这就是我们Jackknife对标准误差 s e se se的估计:
s e ^ j a c k = s e ^ ( θ ^ ) j a c k = n − 1 n ∑ i = 1 n ( θ ^ ( i ) − θ ^ ( . ) ) 2 \begin{aligned} \hat {se}_{jack} &= \sqrt{ \hat {se}(\hat \theta)_{jack} } \\ &= \sqrt{\frac{n-1}{n} \sum_{i=1}^n (\hat \theta_{(i)}- \hat \theta_{(.)})^2 } \end{aligned} se^jack=se^(θ^)jack=nn−1i=1∑n(θ^(i)−θ^(.))2
对统计量 θ ^ \hat \theta θ^的偏差的Jackknife估计是在 θ \theta θ为总体方差的情况下得出的,对统计量 θ ^ \hat \theta θ^的标准误差的Jackknife估计是在 θ \theta θ为总体期望的情况下得出的。那么在 θ \theta θ为其他的未知参数时有可能依这种方法构造出来的Jackknife(对偏差/对标准误差的)估计不是无偏估计,或者非常难以计算其究竟是不是无偏估计。
但是为什么我们还是这样使用 b i a s ^ j a c k \hat {bias}_{jack} bias^jack和 s e ^ j a c k \hat {se}_{jack} se^jack呢?因为我们构造的方法至少要在最简单的情况下成立,如果最简单的情况下我们构造的统计量都不好,那在复杂的情况下肯定更不好了。
最后最重要的一点,Jackknife究竟是用来干什么的?我们再重新回溯一下之前所有的过程。
在特定的情况下,我们就是在这个地方需要Jackknife。因为我们无法重复获得大量的样本,我们现在只有一个样本,所以我们利用Jackknife的方法可以基于我们仅有的样本来构造“新”的样本。我们再基于新的样本来计算偏差的估计和标准误差的估计。
如果我们本身就可以获得大量的样本,那就不需要Jackknife的方法来构造样本了。我们直接通过大量的样本就可以计算偏差的估计和标准误差的估计了。
关于标准误差的定义:https://www.tutorialspoint.com/statistics/standard_error.htm
wiki里面比较简略,没有推导过程
https://en.wikipedia.org/wiki/Jackknife_resampling#CITEREFEfron1982
但我参考了wiki中的参考文献
McIntosh, Avery I. “The Jackknife Estimation Method” (PDF). Boston University. Avery I. McIntosh. Retrieved 2016-04-30.: p. 3.
(上面这个pdf我放在下载资源中了)