Sample Mean and Sample Variance
对一个变量的n个观测值{x1,⋯,xn},有:
x=n1i=1∑Nxi
s2=n−11i=1∑n(xi−x)2
其中x是sample mean, s2是sample variance.
注意这里x,s2和μ,σ2的含义不同,x,s2是μ,σ2的无偏估计量(即前者是后者的期望,后者是前者的估计)。
推导:
E(x)=n1i=1∑nE(xi)=n1(nμ)=μ
E(s2)=n−11i=1∑nE[(xi−μ)2+2(xi−μ)(μ−x)+(μ−x)2]
=n−1nσ2+n−12i=1∑nE[(xi−μ)(μ−x)]+n−1nE[(μ−x)2]
=n−1nσ2+n−12i=1∑nE(μxi−xix−μ2+μx)+n−1nE(μ−x)2
=n−1nσ2+n−12nμ2−2nE(x2)−2nμ2+2nμ2+n−1nμ2−2nμ2+nE(x2)
=n−1nσ2−n−1n[E(x2)−μ2]
=n−1nσ2−n−1nVar(x)
=n−1nσ2−n−1σ2
=σ2
Sample Percentiles
Define the (100p)th sample percentile as:
πp=(1−a/b)yr+(a/b)yr+1=F−1(p)
where r=[(n+1)p],a/b=(n+1)p−r, and F is the cdf.
Then reversely we can conclude:
yr=πr/(n+1)
证明:
假设我们有观测值Y1≤⋯≤Yn,且对于Y有pdf函数f与cdf函数F,则Yr的cdf为:
Gr(y)=P(Yr≤y)=k=r∑n(nk)Fk(y)[1−F(y)]n−k
(这里取组合数,是因为原始数据是无序的,或者说,n次结果是相互独立的)
对其求导得到pdf:
gr(y)=k=r∑n−1(nk)kFk−1(y)f(y)[1−F(y)]n−k
+k=r∑n−1(nk)Fk(y)(n−k)[−f(y)][1−F(y)]n−k−1
+nFn−1(y)f(y)
注意到:
(nk)k=(n−k)!(k−1)!n!,(nk)(n−k)=(n−k−1)!k!n!
因此:
gr(y)=k=r∑n−1(n−k)!(k−1)!n!Fk−1(y)f(y)[1−F(y)]n−k
+k=r∑n−1(n−k−1)!k!n!Fk(y)[−f(y)][1−F(y)]n−k−1
+nFn−1(y)f(y)
神奇的性质出现在了式子中。在推导超几何分布时我们用到过类似技巧,这里也是可以利用这一性质进行消去:
gr(y)=k=r∑n−1(n−k)!(k−1)!n!Fk−1(y)f(y)[1−F(y)]n−k
+k=r+1∑n(n−k)!(k−1)!n!Fk−1(y)[−f(y)][1−F(y)]n−k
+nFn−1(y)f(y)
我们惊喜地发现第一项和第二项可以消去了,且第二项和的最后一项与第三项消去:
gr(y)=(n−r)!(r−1)!n!Fr−1(y)f(y)[1−F(y)]n−r
Five-number summary
Minimum, first quartile, the median, third quartile, maximum.
Q-Q plot
The scatter plot of (yr,πr/(n+1)) is called a quantile-quantile plot.
If a data sample y1<⋯<yn fits the specific model of cdf F, then:
yr≈πr/(n+1),πr/(n+1)≈F−1(n+1r)
Therefore, the Q-Q plot will be a 45-degree line (y=x).