# 0x03 两个总体参数的检验

## 两个总体均值之差的检验

### $$\sigma^2\_1$$, $$\sigma^2\_2$$已知

$$\bar{x}\_1-\bar{x}\_2$$的抽样分布服从正态分布, 可以使用$$z$$统计量进行检验, 如下转换:

$$z=\frac{(\bar{x}\_1-\bar{x}\_2)-(\mu\_1-\mu\_2)}{\sqrt{\frac{\sigma^2\_1}{n\_1}+\frac{\sigma^2\_2}{n\_2}}}$$

### $$\sigma^2\_1$$, $$\sigma^2\_2$$未知, 且样本量$$n$$较小, $$\sigma^2\_1=\sigma^2\_2$$

对$$\hat{\sigma}\_{\bar{x}\_1-\bar{x}\_2}$$的估计为:

$$\hat{\sigma}\_{\bar{x}\_1-\bar{x}\_2}=s\_p\sqrt{\frac{1}{n\_1}+\frac{1}{n\_2}}$$

其中:

$$s^2\_p=\frac{(n\_1-1)s^2\_1+(n\_2-1)s^2\_2}{n\_1+n\_2-2}$$

使用$$t$$检验统计量, 自由度为$$n\_1+n\_2-2$$:

$$t=\frac{(\bar{x}\_1-\bar{x}\_2)-(\mu\_1-\mu\_2)}{s\_p\sqrt{\frac{1}{n\_1}+\frac{1}{n\_2}}}$$

### $$\sigma^2\_1$$, $$\sigma^2\_2$$未知, 且样本量$$n$$较小, $$\sigma^2\_1 \ne \sigma^2\_2$$

对$$\hat{\sigma}\_{\bar{x}\_1-\bar{x}\_2}$$的估计为:

$$\hat{\sigma}\_{\bar{x}\_1-\bar{x}\_2}=\sqrt{\frac{s^2\_1}{n\_1}+\frac{s^2\_2}{n\_2}}$$

使用$$t$$检验统计量, 但此时的自由度为$$f$$:

$$\begin{aligned}f=\frac{(\frac{s^2\_1}{n\_1}+\frac{s^2\_2}{n\_2})^2}{\frac{(s^2\_1/n\_1)^2}{n\_1-1}\frac{(s^2\_2/n\_2)^2}{n\_2-1}}\end{aligned}$$

$$t=\frac{(\bar{x}\_1-\bar{x}\_2)-(\mu\_1-\mu\_2)}{\sqrt{\frac{s^2\_1}{n\_1}+\frac{s^2\_2}{n\_2}}}$$

## 两个总体比例之差的检验

### 检验两个总体比例相等的假设

$$H\_0:\pi\_1=\pi\_2$$

在原假设成立的条件下, 首先计算两个样本合并后得到的**比例估计量**, 即:

$$p=\frac{x\_1+x\_2}{n\_1+n\_2}=\frac{p\_1n\_1+p\_2n\_2}{n\_1+n\_2}$$

则此时样本比例抽样分布的方差为$$p(1-p)$$, 使用$$z$$统计量:

$$z=\frac{p\_1-p\_2}{\sqrt{p(1-p)(\frac{1}{n\_1}+\frac{1}{n\_2})}}$$

### 检验两个总体比例之差不为零的假设

$$H\_0: \pi\_1-\pi\_2=d\_0$$

此时两个样本比例之差$$p\_1-p\_2$$服从以$$\pi\_1-\pi\_2=d\_0$$为期望的正态分布, 使用$$z$$统计量:

$$z=\frac{(p\_1-p\_2)-d\_0}{\sqrt{\frac{p\_1(1-p\_1)}{n\_1}+\frac{p\_2(1-p\_2)}{n\_2}}}$$

## 两个总体方差比的检验

检验两个总体方差是否相等, 通过方差比是否等于1来进行. 如果$$s^2\_1/s^2\_2$$接近于1, 说明两个总体方差$$\sigma^2\_1$$和$$\sigma^2\_2$$很接近.

两个方差之比服从自由度为$$(n\_1-1, n\_2-1)$$的$$F$$分布:

$$F=\frac{s^2\_1/\sigma^2\_1}{s^2\_2/\sigma^2\_2}$$

在单侧检验中, 一般把较大的$$s^2$$放在分子的位置, 此时$$F>1$$, 拒绝域在$$F$$分布的右侧, 对应的原假设为$$H\_0: \sigma^2\_1 \le \sigma^2\_2$$, 临界点为$$F\_{\alpha}(n\_1-1,n\_2-1)$$.

双侧检验中, 拒绝域在$$F$$分布的两侧, 两个临界点分别为: $$F\_{\alpha/2}(n\_1-1,n\_2-1)$$, $$F\_{1-\alpha/2}(n\_1-1,n\_2-1)$$.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://blessbingo.gitbook.io/garnet/math/gai-shuai-lun/tong-ji-tui-duan/0x03-jia-she-jian-yan/0x03-liang-ge-zong-ti-can-shu-de-jian-yan.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
