## Probability and Statistics - 動差(矩) 與 動差生成函數 moment and moment generating 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$

• 離散型 : $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$

• 離散型 : $\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的意義

• $\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)$

$\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$

$\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.