2015年11月5日 星期四

Probability and Statistics - 動差(矩) 與 動差生成函數 moment and moment generating function

沒有留言:
 

在隨機程序和機器學習的課程中同時碰到機率論裡 "動差" 這個概念,雖然有特徵函數這個更好用的工具,但欣賞一下証明並理解數學家的想法也是滿有趣的 : )




一、機率與動差生成函數概述


在機率學中,隨機變數 X 的機率分布通常以二種方式表示

第一種,機率質量/密度函數 (probability mass/density function)

  • 離散型 : 機率質量函數 (probability mass function)
    $p(x_i)=P(X=x_i)$,即 $X$ 等於 $x_i$ 的機率
  • 連續型 : 機率密度函數 (probability density function)
     $f(x)$ 滿足 $P(a\le X\le b)=\int_{a}^bf(x)dx$

第二種,累積分布函數(cumulative distribution function)

  • 離散型 : $ F(x_i) = P(X\le x_i) = \sum_{x_j\le x_i}p(x_j) $,即 $X$ 不大於 $x_i$ 的機率。
  • 連續型 : $ F(x) = P(X\le x) = \int_{-\infty}^xf(z)dz $


而今天的主角是第三種,動差生成函數 (moment generating function),先看一下他的形式 :

  • 離散型 : $ \displaystyle  m(t)=E\left(e^{Xt}\right)=E\left(\sum_{k=0}^{\infty}\frac{X^kt^k}{k!}\right)=\sum_{k=0}^{\infty}\frac{\mu_kt^k}{k!}=\sum_{i=1}^\infty e^{x_it}p(x_i) $
  • 連續型 :  $ \displaystyle  m(t)=E\left(e^{Xt}\right)=E\left(\sum_{k=0}^{\infty}\frac{X^kt^k}{k!}\right)=\sum_{k=0}^{\infty}\frac{\mu_kt^k}{k!}=\int_{-\infty}^{\infty}e^{xt}f(x)dx $

下面用離散型隨機變數來說明moment和moment generating function的意義。





二、moment和moment generating function的意義


一般高中數學中,我們用期望值 $\mu$ 來測量機率分布$ p $的集中趨勢,並用變異數 $\sigma^2$ 來測量分布的離散趨勢:

  • $\mu = E(X) = \sum_{i=1}^\infty x_ip(x_i)  $
  • $\sigma^2 = E(X-\mu)^2=\sum_{i=1}^\infty(x_i-\mu)^2p(x_i)  $

這時候數學家就想知道,如果已經知道期望值$ \mu $和變異數 $\sigma^2$,還必須知道哪些訊息才能唯一決定一個機率分布 p?因為 E 是線性算子,根據變異數定義,

 $\sigma^2 = E(X-\mu)^2=E(X^2-2X\mu+\mu^2)$
   $=E(X^2)-2E(X)\mu+\mu^2=E(X^2)-(E(X))^2$

上式指出 $E(X)$ 和 $E(X^2)$ 決定了 $\mu$ 和 $\sigma^2$,這指引我們前進的方向。設隨機變數 X 的值域為$ \{x_1,x_2,\ldots\}$,$X^k$ 的期望值稱為 $X$ 的$ k $次動差 (moment,或稱原點動差),定義如下:

$\displaystyle  \mu_k=E\left(X^k\right)=\sum_{i=1}^\infty (x_i)^kp(x_i)。$

從外表很難想像一個隨機變數的動差生成函數是機率分布的另一種表達,但我們能證明若離散型隨機變數的值域為一有限集,則機率分布完全由動差決定(收斂且唯一)


[ 用心去感覺 ]


  • 動差母函數計算動差的機會並不太多。動差母函數與其說是一種計算動差工具,不如說是對機率分布的一種函數變換,就好比 Fourier transform 一樣。

    事實上,動差母函數、特徵函數、Laplace 變換以及 Fourier 變換,幾乎是一樣的東西,只是轉換後的函數定義域不同或定義方式略有不同而有不同表現,但本質可以說是相同的。例如 ,動差生成函數若存在則唯一決定一個機率分布,特徵函數也是唯一決定一個分布,Laplace 變換也唯一決定一個函數。
  • 上面的moment generating function說明也可以總結為 : 動差生成函數可以作為一個隨機變數的"ID",意思是如果兩個隨機變數 X, Y 的動差生成函數 $E(e^tX)$, $E(e^tY)$ 相同,則這兩個隨機變數必然相同。


[補充]  the moments exist, but the mgf does not - lognormal distribution


Naturally, the moment generating function was infinite. we will give an example of a distribution for which all of the moments are finite, yet still the moment generating function is infinite. Furthermore, we will see two different distributions that have the same moments of all orders.

Suppose that Z has the standard normal distribution and let X = exp(Z). The distribution of X is known as a lognormal distribution.

All moments of the log-normal distribution exist and it holds that: $ \operatorname{E}(X^n)=\mathrm{e}^{n\mu+\frac{n^2\sigma^2}{2}} $ (which can be derived by letting $ z=\frac{\ln(x) - (\mu+n\sigma^2)}{\sigma} $ within the integral) . However, the expected value $ \operatorname{E}(e^{t X}) $ is not defined for any positive value of the argument t as the defining integral diverges. In consequence the moment generating function is not defined. The last is related to the fact that the lognormal distribution is not uniquely determined by its moments.


When the mgf exists as a function (and not just as a formal power series) then it can be inverted to produce a unique density to which it corresponds.









沒有留言:

張貼留言

技術提供:Blogger.