← 返回主页

FS 核心易错点

易错点排雷 / 核心考点梳理
基于真实错题与笔记提取

CH5 生成函数(Generating Functions)

CH5 生成函数(Generating Functions)

生成函数的基本概念与应用

生成函数是一种强大的工具,用于处理离散随机变量的概率分布。通过生成函数,我们可以方便地计算期望、方差等统计量,并且可以处理多个独立随机变量的和。

  • 定义: $$\begin{aligned}&= G_X(t) \ &= \sum_{k=0}^{\infty} P(X = k)t^k\end{aligned}$$

  • 关键应用

  • 众数(mode):使 $P(X = k)$ 最大的 $k$
  • 独立变量和:$G_{X+Y}(t) = G_X(t) \cdot G_Y(t)$
  • 线性变化:$G_{aX+b}(t) = t^b G_X(t^a)$

  • 期望:直接看公示表

  • 潜在难点:理论上题目可以给一个分布或者一个描述,然后你要机智地算出对应的每一个概率,然后根据定义写出自己的 $G_X(t)$。

例如:几何分布: $$\begin{aligned}&= G_X(t) \ &= \frac{pt}{1 - (1 - p)t}\end{aligned}$$

但本质还是概率是系数,指数是值,剩下的都是老套路很 ez~

CH1 概率密度函数与累积分布函数

CH1 概率密度函数与累积分布函数

PDF → 积分 → CDF → 求逆 → 分位数

基本概念
  • 概率密度函数(PDF) $ f(x) $,满足
    $$\begin{aligned}&= \int_{-\infty}^{\infty} f(x)\,dx \ &= 1\end{aligned}$$

  • 累积分布函数(CDF) $ F(x) = \int_{-\infty}^{x} f(t)\,dt $【从 0 到 1】

期望值与方差
  • 期望
    $$\begin{aligned}&= E(X) \ &= \int_{-\infty}^{\infty} x\,f(x)\,dx\end{aligned}$$

  • 二阶矩
    $$\begin{aligned}&= E(X^2) \ &= \int_{-\infty}^{\infty} x^2\,f(x)\,dx\end{aligned}$$

  • 方差
    $$\begin{aligned}&= \text{Var}(X) \ &= E(X^2) - [E(X)]^2\end{aligned}$$

  • 变形 e.g.
    $$\begin{aligned}&= \text{Var}(\sqrt{X}) \ &= E(X) - [E(\sqrt{X})]^2 \ &= \int_{-\infty}^{\infty} x f(x)\,dx - \left( \int_{-\infty}^{\infty} \sqrt{x}\,f(x)\,dx \right)^2\end{aligned}$$

变量变换

虽然从来没有考过,但是书上出现过,就是注意 $ Y $ 和 $ X $ 转化时候,绕 $ F(Y) $ 和 $ F(X) $ 时候,可能要 1 减。

例如:$ F(X) = X^2 $,换元 $ Y = \dfrac{1}{X} $,则
$$\begin{aligned}&= G(Y) \ &= 1 - \frac{1}{Y^2}\end{aligned}$$

因为当比如 $ X < 2 $ 时候,其实 $ Y > 1/2 $,所以要 1 减一下。

三种检测:T/Z

三种检测:T/Z

Normal Distribution

类型 情况 公式
One sample $\frac{\bar{x}-\mu}{s/\sqrt{n}} \sim t_{n-1}$
Two sample $n \leq 30$ $\frac{(\bar{x}-\bar{y})-(\mu_x-\mu_y)}{S_p\sqrt{\frac{1}{n_x}+\frac{1}{n_y}}} \sim t_{n_x+n_y-2}$
$n \geq 30$ $\frac{(\bar{x}-\bar{y})-(\mu_x-\mu_y)}{\sqrt{\frac{s_x^2}{n_x}+\frac{s_y^2}{n_y}}} \sim Z \sim N(0,1)$
Before & After paired sample T $\frac{d-k}{s_d/\sqrt{n}} \sim t_{n-1}$ where $H_0: \mu_e = k$
注意事项
  • 注意 $S_d$ 的公式在公式纸有
  • 题目给你 $\sum x$, $\sum y^2$ 这种,一般都是 two sample z。有些题目很阴险,一定一组数据分两次,那就是 one sample,然后也是老样子去求。
  • paired 不用特意去记,减完就是正常的 one sample。然后一般 paired 一定会有个 before after 之类的对应关系。
  • C.I. 就是反过来,也不用特意去记
  • 题目 one tail 还是 two tail 看最后提出质疑的人是想说 more 还是 not equal to

Confidence Interval = $100(\alpha - 1)\%$

类型 情况 公式
One sample $\bar{x} \pm (t_{n-1,\alpha}) \cdot \frac{s}{\sqrt{n}}$
Two sample $n \leq 30$ $(\bar{x} - \bar{y}) \pm (t_{\alpha,n_x+n_y-2}) \cdot S_p\sqrt{\frac{1}{n_x}+\frac{1}{n_y}}$
$n \geq 30$ $(\bar{x} - \bar{y}) \pm (z_\alpha) \cdot \sqrt{\frac{s_x^2}{n_x}+\frac{s_y^2}{n_y}}$
Before & After $d \pm (t_{\alpha,n-1}) \cdot \frac{s_d}{\sqrt{n}}$

Chi Square

$$\begin{aligned}&= \chi^2 \ &= \sum \frac{(O - E)^2}{E} \quad \text{for all}\end{aligned}$$

  • 没有 one or two tail
  • 注意所有类型的,期待值不到 5 都要合并
  • 注意 df 的计算
分布类型 自由度(df)公式
Binomial $ \nu = n - 1 $ if $ p $ not estimated
$ \nu = n - 2 $ if $ p $ estimated
Poisson $ \nu = n - 1 $ if $ \lambda $ not estimated
$ \nu = n - 2 $ if $ \lambda $ estimated
Normal $ \nu = n - 1 $ if $ \mu $ and $ \sigma^2 $ not estimated
$ \nu = n - 2 $ if $ \mu $ or $ \sigma^2 $ estimated
$ \nu = n - 3 $ if $ \mu $ and $ \sigma^2 $ estimated
  • 期望值:$ \dfrac{\text{该行的和} \times \text{该列的和}}{\text{总和}} $(原理是默认行和列之间分布互不影响)
  • DF:(行数 - 1) × (列数 - 1) 【合并后的】
三种检测:Wilcoxon

三种检测:Wilcoxon

基本根据公式纸走即可,除了一开始的 signed test 没有:

Signed test

  • $ N_+ = \text{number of } + \text{ signs},\ N_- = \text{number of } - \text{ signs} $
  • $ T = \min(N_+, N_-) $
  • Perform $ B(T, 0.5),\ P(X \leq T) $
对应的 normalization

Let $ S = \min(\text{number of } + \text{ signs},\ \text{number of } - \text{ signs}) $, then
$ \mathbb{E}(S) = \frac{n}{2},\ \mathrm{Var}(S) = \frac{n}{4} $.

For large $ n (> 10) $, $ T \sim \mathcal{N}\left( \frac{n}{2}, \frac{n}{4} \right) $, we can use the normal approximation of the binomial with $ p = 0.5 $. We must also make sure that we use a continuity correction. As we are approximating a discrete distribution with a continuous distribution, our z-value is: $$\begin{aligned}&= z \ &= \frac{S^+ - \mu + 0.5}{\sigma}\end{aligned}$$

最后各自常考的假设

  • T-test: underlying data is normally distributed
  • Wilcoxon: underlying data is symmetric
  • 全部都有的: independent