BIOS14: Hypothesis testing(假设检验)using R

这篇博客介绍了如何使用R进行假设检验,包括一、二样本和配对样本t检验的步骤及注意事项。通过实例探讨了错误类型、检验过程和决策区域,并强调了正态性和方差齐性的检查。最后,展示了如何解释和展示检验结果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

NOTES

1 The basic problem of hypothesis test

1.1 Example

year weight of new born (mean) size of data SD
1989 3190 g ∞ \infty 80 g
1990 3210 g 100 NA

It is obvious that the mean of 100 new born’s weight is 20g higher than that of 1989.

The point here is that what is shown by this 20 g diference. One explain is that it caused by randomness of sampling. Or it is true that baby born in 1990 is weighter than born in 1989.

To figure out this problem, we use μ 0 \mu_0 μ0 indecate the mean of baby’s weight in 1989 and μ \mu μ indecate that of 1990. We hypothesize that μ = μ 0 \mu=\mu_0 μ=μ0, and use 100 samples in 1990 to test whether the hypothesis is true or not.

Here
Null hypothesis: H 0 : μ = 3190 g H_0:\mu=3190g H0:μ=3190g
If the null hypothesis is not stand, we need an alternative hypothesis:
Alternative hypothesis: H 1 : μ ≠ 3190 g H_1:\mu \ne 3190g H1:μ=3190g

1.2 Two type error

α   e r r o r \alpha\ error α error: H 0 H_0 H0 is right but is rejected.
β   e r r o r \beta\ error β error: H 1 H_1 H1 is wrong but is accepted.

1.3 The procedure of hypothesis test

  1. raise hypothesis:
    H 0 : μ = 3190 g H_0:\mu=3190g H0:μ=3190g
    H 1 : μ ≠ 3190 g H_1:\mu \ne 3190g H1:μ=3190g
  2. statistics ( σ \sigma σ is known, sample > 30):
    z = x ˉ − μ 0 σ n = 3210 − 3190 80 / 100 = 2.5 z=\frac{\bar{x}-\mu_0}{\sigma\sqrt{n}}=\frac{3210-3190}{80/\sqrt{100}}=2.5 z=σn xˉμ0=80/100 32103190=2.5
  3. z α 2 = ± 1.96 < 2.5 z_{\frac{\alpha}{2}}=\pm1.96<2.5 z2α=±1.96<2.5, z z z is in the critical region, so we reject H 0 H_0 H0.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值