矩估計法
矩估計法的定義
矩估計法是用樣本 k k k階矩作為總體的 k k k階矩的估計量,建立含待估計參數的方程,進而解出帶估計參數。矩估計中,總體均值與方差的矩估計量的表達式不因不同的總體分布而異。通俗的講就是:
例如,不論總體服從什麼分布,總體期望 μ \mu μ,與方差 δ 2 \delta^2 δ2存在,則根據矩估計法,它們的估計量分别為 μ ^ = 1 n ∑ i = 1 n X i = X ˉ δ ^ 2 = 1 n ∑ i = 1 n ( X i − X ˉ ) 2 = S n 2 \hat{\mu}=\frac{1}{n}\sum\limits_{i=1}^n{X_i}=\bar{X} \\\hat{\delta}^2=\frac{1}{n}\sum\limits_{i=1}^n{(X_i-\bar{X})^2}=S^2_n μ^=n1i=1∑nXi=Xˉδ^2=n1i=1∑n(Xi−Xˉ)2=Sn2
當 1 n − 1 ∑ i = 1 n ( X i − X ˉ ) 2 = S n 2 \frac{1}{n-1}\sum\limits_{i=1}^n{(X_i-\bar{X})^2}=S^2_n n−11i=1∑n(Xi−Xˉ)2=Sn2時,是無偏矩估計。當然,矩估計不唯一。
一般地,用樣本均值 X ˉ = 1 n ∑ i = 1 n X i \bar{X}=\frac{1}{n}\sum\limits_{i=1}^n{X_i} Xˉ=n1i=1∑nXi作為總體的均值的矩估計。
用樣本二階中心距 B 2 = 1 n ∑ i = 1 n ( X i − X ˉ ) 2 B_2=\frac{1}{n}\sum\limits_{i=1}^n{(X_i-\bar{X})^2} B2=n1i=1∑n(Xi−Xˉ)2作為總體方差的的矩估計。
矩估計法的依據
設 X X X為連續型随機變量,其機率密度為 f ( x ; θ 1 , θ 2 , θ 3 , ⋯   , θ k ) f(x;\theta_1,\theta_2,\theta_3,\cdots,\theta_k) f(x;θ1,θ2,θ3,⋯,θk),設 X X X為離散型随機變量,其分布律為 P { X = x } = p ( x ; θ 1 , θ 2 , θ 3 , ⋯   , θ k ) P\{X=x\}=p(x;\theta_1,\theta_2,\theta_3,\cdots,\theta_k) P{X=x}=p(x;θ1,θ2,θ3,⋯,θk),其中 θ 1 , θ 2 , θ 3 , ⋯   , θ k \theta_1,\theta_2,\theta_3,\cdots,\theta_k θ1,θ2,θ3,⋯,θk為待估參數, X 1 , X 2 , X 3 , ⋯   , X n X_1,X_2,X_3,\cdots,X_n X1,X2,X3,⋯,Xn來自 X X X的,假設總體 X X X的前 k k k階矩且均為 θ 1 , θ 2 , θ 3 , ⋯   , θ k \theta_1,\theta_2,\theta_3,\cdots,\theta_k θ1,θ2,θ3,⋯,θk的函數,即
μ l = E ( X l ) = ⎰ + ∞ − ∞ x l f ( x ; θ 2 , θ 3 , ⋯   , θ k ) d x ( X 為 連 續 型 變 量 ) μ l = E ( X l ) = ∑ x ∈ R X x l p ( x ; θ 1 , θ 2 , θ 3 , ⋯   , θ k ) ( X 為 離 散 型 變 量 ) \mu_l=E(X_l)=\lmoustache_{+\infty}^{-\infty}x^lf(x;\theta_2,\theta_3,\cdots,\theta_k)dx\quad(X為連續型變量) \\\quad \\\mu_l=E(X_l)=\sum\limits_{x\in R_X}{x^lp(x;\theta_1,\theta_2,\theta_3,\cdots,\theta_k)}\quad(X為離散型變量) μl=E(Xl)=⎰+∞−∞xlf(x;θ2,θ3,⋯,θk)dx(X為連續型變量)μl=E(Xl)=x∈RX∑xlp(x;θ1,θ2,θ3,⋯,θk)(X為離散型變量)
R X R_X RX是 x x x可能取值的範圍, l = 1 , 2 , 3 , ⋯   , k l=1,2,3,\cdots,k l=1,2,3,⋯,k,因為樣本矩的連續函數依機率收斂于相應的總體矩的連續函數,樣本矩 A l = 1 n ∑ i = 1 n X i l A_l=\frac{1}{n}\sum\limits_{i=1}^n{X_i^l} Al=n1i=1∑nXil依機率收斂于相應的總體矩 μ l \mu_l μl。
矩估計的一般步驟
- 令 μ l = A l , l = 1 , 2 , 3 , ⋯   , k \mu_l=A_l,l=1,2,3,\cdots,k μl=Al,l=1,2,3,⋯,k,這是一個包含 k 個未知參數 θ 1 , θ 2 , θ 3 , ⋯   , θ k \theta_1,\theta_2,\theta_3,\cdots,\theta_k θ1,θ2,θ3,⋯,θk的方程組;
- 解出其中的 θ 1 , θ 2 , θ 3 , ⋯   , θ k \theta_1,\theta_2,\theta_3,\cdots,\theta_k θ1,θ2,θ3,⋯,θk;
- 用方程組的解 θ ^ 1 , θ ^ 2 , θ ^ 3 , ⋯   , θ ^ k \hat{\theta}_1,\hat{\theta}_2,\hat{\theta}_3,\cdots,\hat{\theta}_k θ^1,θ^2,θ^3,⋯,θ^k分别作為 θ 1 , θ 2 , θ 3 , ⋯   , θ k \theta_1,\theta_2,\theta_3,\cdots,\theta_k θ1,θ2,θ3,⋯,θk的估計量。
例題
例1:設總體 X X X的機率密度函數為
f ( x , θ ) = 1 2 θ e − ∣ x ∣ θ , − ∞ < x < + ∞ , θ > 0 f(x,\theta)=\frac{1}{2\theta}e^{-\frac{|x|}{\theta}},\quad -\infty<x<+\infty,\quad\theta>0 f(x,θ)=2θ1e−θ∣x∣,−∞<x<+∞,θ>0,求 θ \theta θ的矩估計量。
解: f ( x ; θ ) f(x;\theta) f(x;θ)中僅含有一個 θ \theta θ,
E ( X ) = ⎰ − ∞ + ∞ x 1 2 θ e − ∣ x ∣ θ d x = 0 E(X)=\lmoustache_{-\infty}^{+\infty}{x\frac{1}{2\theta}e^{-\frac{|x|}{\theta}}}dx=0 E(X)=⎰−∞+∞x2θ1e−θ∣x∣dx=0
E ( X ) E(X) E(X)中不含有 θ \theta θ,是以無法解出 θ \theta θ的矩估計量。需繼續求總體的二階原點矩。
E ( X 2 ) = ⎰ − ∞ + ∞ x 2 1 2 θ e − ∣ x ∣ θ d x = 1 θ ⎰ 0 + ∞ x 2 e − x θ d x = θ 2 Γ ( 3 ) = 2 θ 2 \begin{aligned} E(X^2)&=\lmoustache_{-\infty}^{+\infty}{x^2\frac{1}{2\theta}e^{-\frac{|x|}{\theta}}}dx\\ &=\frac{1}{\theta}\lmoustache_0^{+\infty}x^2e^{-\frac{x}{\theta}}dx\\ &=\theta^2\Gamma(3)\\ &=2\theta^2\\ \end{aligned} E(X2)=⎰−∞+∞x22θ1e−θ∣x∣dx=θ1⎰0+∞x2e−θxdx=θ2Γ(3)=2θ2
用 A 2 = 1 n ∑ i = 1 n X i 2 A_2=\frac{1}{n}\sum\limits_{i=1}^n{X^2_i} A2=n1i=1∑nXi2替換 E ( X 2 ) E(X^2) E(X2),則 A 2 = 1 n ∑ i = 1 n X i 2 = 2 θ 2 A_2=\frac{1}{n}\sum\limits_{i=1}^n{X^2_i}=2\theta^2 A2=n1i=1∑nXi2=2θ2,得出 θ \theta θ的矩估計量為
θ ^ = 1 2 1 n ∑ i = 1 n X i 2 = A 2 2 , θ > 0 \hat{\theta}=\sqrt{\frac{1}{2}\frac{1}{n}\sum\limits_{i=1}^n{X^2_i}}=\sqrt{\frac{A_2}{2}} \quad,\quad \theta>0 θ^=21n1i=1∑nXi2
=2A2
,θ>0
例2
設總體 X X X的均值 μ \mu μ和方差 δ 2 \delta^2 δ2都存在,且有 δ > 0 \delta>0 δ>0,但 μ \mu μ和 δ 2 \delta^2 δ2均為未知,又設 X 1 , X 2 , X 3 , ⋯   , X n X_1,X_2,X_3,\cdots,X_n X1,X2,X3,⋯,Xn是一個樣本,求 μ \mu μ和 δ 2 \delta^2 δ2的矩估計量。
解:
μ 1 = E ( X ) = μ μ 2 = E ( X 2 ) = D ( X ) + [ E ( X ) ] 2 = δ 2 + μ 2 \begin{aligned} \mu_1&=E(X)=\mu\\ \mu_2&=E(X^2)=D(X)+[E(X)]^2=\delta^2+\mu^2 \end{aligned} μ1μ2=E(X)=μ=E(X2)=D(X)+[E(X)]2=δ2+μ2
令
{ μ = A 1 δ 2 + μ 2 = A 2 \left\{ \begin{aligned} &\mu=A_1\\ \\\quad &\delta^2+\mu^2=A_2 \end{aligned} \right. ⎩⎪⎨⎪⎧μ=A1δ2+μ2=A2
解得
{ μ = μ 1 δ 2 = μ − μ 1 2 \left\{ \begin{aligned} &\mu=\mu_1\\ \\\quad &\delta^2=\mu-\mu_1^2 \end{aligned} \right. ⎩⎪⎨⎪⎧μ=μ1δ2=μ−μ12
則
μ ^ = A 1 = X ˉ δ ^ 2 = A 2 − A 1 2 = 1 n ∑ i = 1 n X i 2 − X ˉ = 1 n ∑ i = 1 n ( X i − X ˉ ) 2 \begin{aligned} \hat{\mu}&=A_1=\bar{X}\\ \hat{\delta}^2&=A_2-A_1^2\\ &=\frac{1}{n}\sum\limits_{i=1}^n{X^2_i}-\bar{X}\\ &=\frac{1}{n}\sum\limits_{i=1}^n{(X_i-\bar{X})^2} \end{aligned} μ^δ^2=A1=Xˉ=A2−A12=n1i=1∑nXi2−Xˉ=n1i=1∑n(Xi−Xˉ)2
例3
設總體 X X X在 [ a , b ] [a,b] [a,b]上服從均勻分布, 其中 a , b a, b a,b未知, X 1 , X 2 , X 3 , ⋯   , X n X_1,X_2,X_3,\cdots,X_n X1,X2,X3,⋯,Xn是一個樣本,求 a , b a, b a,b的估計量。
解:
μ 1 = E ( X ) = a + b 2 μ 2 = E ( X 2 ) = D ( X ) + [ E ( X ) ] 2 = ( a − b ) 2 12 + ( a + b ) 2 4 \begin{aligned} \mu_1&=E(X)=\frac{a+b}{2}\\ \mu_2&=E(X^2)=D(X)+[E(X)]^2\\ &=\frac{(a-b)^2}{12}+\frac{(a+b)^2}{4} \end{aligned} μ1μ2=E(X)=2a+b=E(X2)=D(X)+[E(X)]2=12(a−b)2+4(a+b)2
令
A 1 = a + b 2 = 1 n ∑ i = 1 n X i A 2 = ( a − b ) 2 12 + ( a + b ) 2 4 = 1 n ∑ i = 1 n X i 2 \begin{aligned} A_1&=\frac{a+b}{2}=\frac{1}{n}\sum\limits_{i=1}^n{X_i}\\ A_2&=\frac{(a-b)^2}{12}+\frac{(a+b)^2}{4}=\frac{1}{n}\sum\limits_{i=1}^n{X^2_i} \end{aligned} A1A2=2a+b=n1i=1∑nXi=12(a−b)2+4(a+b)2=n1i=1∑nXi2
則
{ a + b = 2 A 1 b − a = 12 ( A 2 − A 1 2 ) \left\{ \begin{aligned} &a+b=2A_1\\ \\\quad &b-a=\sqrt{12(A_2-A_1^2)} \end{aligned} \right. ⎩⎪⎪⎨⎪⎪⎧a+b=2A1b−a=12(A2−A12)
則 a , b a,b a,b的估計量為:
a ^ = X ˉ − 3 n ∑ i = 1 n ( X i − X ˉ ) 2 b ^ = X ˉ + 3 n ∑ i = 1 n ( X i − X ˉ ) 2 \begin{aligned} &\hat{a}=\bar{X}-\sqrt{\frac{3}{n}\sum\limits^n_{i=1}{(X_i-\bar{X})^2}}\\ &\hat{b}=\bar{X}+\sqrt{\frac{3}{n}\sum\limits^n_{i=1}{(X_i-\bar{X})^2}} \end{aligned} a^=Xˉ−n3i=1∑n(Xi−Xˉ)2
b^=Xˉ+n3i=1∑n(Xi−Xˉ)2
最大似然估計
似然函數的定義
-
總體X是連續型:設機率密度為 f ( x ; θ ) f(x;\theta) f(x;θ), θ \theta θ為待估參數, θ ∈ Θ \theta\in\Theta θ∈Θ, Θ \Theta Θ是 θ \theta θ可能的取值範圍。設 X 1 , X 2 , X 3 , ⋯   , X n X_1,X_2,X_3,\cdots,X_n X1,X2,X3,⋯,Xn是來自X的樣本,則 X 1 , X 2 , X 3 , ⋯   , X n X_1,X_2,X_3,\cdots,X_n X1,X2,X3,⋯,Xn的聯合密度為 ∏ i = 1 n f ( x ; θ ) \prod\limits^n_{i=1}f(x;\theta) i=1∏nf(x;θ),設 x 1 , x 2 , x 3 , ⋯   , x n x_1,x_2,x_3,\cdots,x_n x1,x2,x3,⋯,xn為相應樣本 X 1 , X 2 , X 3 , ⋯   , X n X_1,X_2,X_3,\cdots,X_n X1,X2,X3,⋯,Xn的一個樣本值,則随機點 ( X 1 , X 2 , X 3 , ⋯   , X n ) (X_1,X_2,X_3,\cdots,X_n) (X1,X2,X3,⋯,Xn)落在點 x 1 , x 2 , x 3 , ⋯   , x n x_1,x_2,x_3,\cdots,x_n x1,x2,x3,⋯,xn的鄰域内的機率近似地為 ∏ i = 1 n f ( x ; θ ) d x i \prod\limits^n_{i=1}f(x;\theta)dx_i i=1∏nf(x;θ)dxi。則
L ( θ ) = L ( x 1 , x 2 , x 3 , ⋯   , x n ; θ ) = ∏ i = 1 n f ( x ; θ ) L(\theta)=L(x_1,x_2,x_3,\cdots,x_n;\theta)=\prod\limits^n_{i=1}f(x;\theta) L(θ)=L(x1,x2,x3,⋯,xn;θ)=i=1∏nf(x;θ)
L ( θ ) L(\theta) L(θ)稱為樣本的似然函數。
-
總體X是離散型:設分布律 P { X = x } = p ( x ; θ ) P\{X=x\}=p(x;\theta) P{X=x}=p(x;θ), θ ∈ Θ \theta\in\Theta θ∈Θ的形式是已知的, θ \theta θ為待估參數, Θ \Theta Θ是 θ \theta θ可能的取值範圍。設 X 1 , X 2 , X 3 , ⋯   , X n X_1,X_2,X_3,\cdots,X_n X1,X2,X3,⋯,Xn是來自X的樣本,則 X 1 , X 2 , X 3 , ⋯   , X n X_1,X_2,X_3,\cdots,X_n X1,X2,X3,⋯,Xn的聯合分布律為 ∏ i = 1 n p ( x i ; θ ) \prod\limits^n_{i=1}p(x_i;\theta) i=1∏np(xi;θ)
設 x 1 , x 2 , x 3 , ⋯   , x n x_1,x_2,x_3,\cdots,x_n x1,x2,x3,⋯,xn為相應樣本 X 1 , X 2 , X 3 , ⋯   , X n X_1,X_2,X_3,\cdots,X_n X1,X2,X3,⋯,Xn的一個樣本值,則 X 1 , X 2 , X 3 , ⋯   , X n X_1,X_2,X_3,\cdots,X_n X1,X2,X3,⋯,Xn取到觀察值 x 1 , x 2 , x 3 , ⋯   , x n x_1,x_2,x_3,\cdots,x_n x1,x2,x3,⋯,xn的機率,即 { X 1 = x 1 , X 2 = x 2 , X 3 = x 3 , ⋯   , X n = x n } \{X_1=x_1,X_2=x_2,X_3=x_3,\cdots,X_n=x_n\} {X1=x1,X2=x2,X3=x3,⋯,Xn=xn}的機率為
L ( θ ) = L ( x 1 , x 2 , x 3 , ⋯   , x n ; θ ) = ∏ i = 1 n p ( x i ; θ ) , θ ∈ Θ L(\theta)=L(x_1,x_2,x_3,\cdots,x_n;\theta)=\prod\limits^n_{i=1}p(x_i;\theta),\theta\in\Theta L(θ)=L(x1,x2,x3,⋯,xn;θ)=i=1∏np(xi;θ),θ∈Θ
L ( θ ) L(\theta) L(θ)稱為樣本的似然函數
最大似然估計的求解步驟
1.寫出似然函數
L ( θ ) = L ( x 1 , x 2 , x 3 , ⋯   , x n ; θ ) = ∏ i = 1 n p ( x i ; θ ) L(\theta)=L(x_1,x_2,x_3,\cdots,x_n;\theta)=\prod\limits^n_{i=1}p(x_i;\theta) L(θ)=L(x1,x2,x3,⋯,xn;θ)=i=1∏np(xi;θ)
或者
L ( θ ) = L ( x 1 , x 2 , x 3 , ⋯   , x n ; θ ) = ∏ i = 1 n f ( x ; θ ) L(\theta)=L(x_1,x_2,x_3,\cdots,x_n;\theta)=\prod\limits^n_{i=1}f(x;\theta) L(θ)=L(x1,x2,x3,⋯,xn;θ)=i=1∏nf(x;θ)
2.取對數
l n L ( θ ) = ∑ i = 1 n l n p ( x i ; θ ) 或 者 l n L ( θ ) = ∑ i = 1 n l n f ( x i ; θ ) \begin{aligned} &lnL(\theta)=\sum\limits^n_{i=1}ln\ p(x_i;\theta)\\ &或者\\ &lnL(\theta)=\sum\limits^n_{i=1}ln\ f(x_i;\theta) \end{aligned} lnL(θ)=i=1∑nln p(xi;θ)或者lnL(θ)=i=1∑nln f(xi;θ)
3.對 θ \theta θ求導 d l n L ( θ ) d θ \frac{dlnL(\theta)}{d\theta} dθdlnL(θ),并且令 d l n L ( θ ) d θ = 0 \frac{dlnL(\theta)}{d\theta}=0 dθdlnL(θ)=0,解方程即得未知參數 θ \theta θ的最大似然估計值 θ ^ \hat{\theta} θ^。
例題
設總體 X X X在 [ a , b ] [a,b] [a,b]上服從均勻分布, 其中 a , b a,b a,b未知, x 1 , x 2 , x 3 , ⋯   , x n x_1,x_2,x_3,\cdots,x_n x1,x2,x3,⋯,xn是來自總體 X X X的一個樣本值,求 a , b a,b a,b的最大似然估計量。
解:令
x m i n = m i n x 1 , x 2 , x 3 , ⋯   , x n x m a x = m a x x 1 , x 2 , x 3 , ⋯   , x n \begin{aligned} x_{min}=min{x_1,x_2,x_3,\cdots,x_n} \\x_{max}=max{x_1,x_2,x_3,\cdots,x_n} \end{aligned} xmin=minx1,x2,x3,⋯,xnxmax=maxx1,x2,x3,⋯,xn
X X X的機率密度函數為
f ( x ; a , b ) = { 1 b − a , a ≤ x ≤ b 0 , 其 他 \begin{aligned} f(x;a,b)={\left\{\begin{aligned}&\frac{1}{b-a},a\leq x\leq b\\ &0,\quad \quad 其他 \end{aligned} \right.} \end{aligned} f(x;a,b)=⎩⎨⎧b−a1,a≤x≤b0,其他
則似然函數為
L ( a , b ) = { 1 ( b − a ) n , a ≤ x 1 , x 2 , x 3 , ⋯   , x n ≤ b 0 , 其 他 \begin{aligned} L(a,b)={\left\{\begin{aligned}&\frac{1}{(b-a)^n},a\leq x_1,x_2,x_3,\cdots,x_n\leq b\\ &\quad \ 0,\quad \quad \quad 其他 \end{aligned} \right.} \end{aligned} L(a,b)=⎩⎪⎨⎪⎧(b−a)n1,a≤x1,x2,x3,⋯,xn≤b 0,其他
由于 a ≤ x 1 , x 2 , x 3 , ⋯   , x n v b a\leq x_1,x_2,x_3,\cdots,x_nvb a≤x1,x2,x3,⋯,xnvb即 a ≤ x m i n , x m a x ≤ b a\leq x_{min},x_{max}\leq b a≤xmin,xmax≤b
是以
L ( a , b ) = { 1 ( b − a ) n , a ≤ x m i n , x m a x ≤ b 0 , 其 他 \begin{aligned} L(a,b)={\left\{\begin{aligned}&\frac{1}{(b-a)^n},a\leq x_{min},x_{max}\leq b\\ &\quad \ 0,\quad \quad \quad 其他 \end{aligned} \right.} \end{aligned} L(a,b)=⎩⎪⎨⎪⎧(b−a)n1,a≤xmin,xmax≤b 0,其他
對于滿足條件的 a ≤ x m i n , x m a x ≤ b a\leq x_{min},x_{max}\leq b a≤xmin,xmax≤b的任意 a , b a,b a,b有
L ( a , b ) = 1 ( b − a ) n ≤ 1 ( x m a x − x m i n ) 2 L(a,b)=\frac{1}{(b-a)^n}\leq \frac{1}{(x_{max}-x_{min})^2} L(a,b)=(b−a)n1≤(xmax−xmin)21
即似然函數在 a = x m i n , b = x m a x a=x_{min},b=x_{max} a=xmin,b=xmax時取得最大值 1 ( x m a x − x m i n ) 2 \frac{1}{(x_{max}-x_{min})^2} (xmax−xmin)21。
是以 a , b a,b a,b的最大似然估計值為
a ^ = x m i n = min 1 ≤ i ≤ n x i b ^ = x m a x = max 1 ≤ i ≤ n x i \begin{aligned} \hat{a}=x_{min}=\min\limits_{1\leq i\leq n}x_i \\\hat{b}=x_{max}=\max\limits_{1\leq i\leq n}x_i \end{aligned} a^=xmin=1≤i≤nminxib^=xmax=1≤i≤nmaxxi
a , b a,b a,b的最大似然估計量為
a ^ = min 1 ≤ i ≤ n X i b ^ = max 1 ≤ i ≤ n X i \begin{aligned} \hat{a}=\min\limits_{1\leq i\leq n}X_i \\\hat{b}=\max\limits_{1\leq i\leq n}X_i \end{aligned} a^=1≤i≤nminXib^=1≤i≤nmaxXi