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: H0:μ=3190gH_0:\mu=3190gH0:μ=3190g
If the null hypothesis is not stand, we need an alternative hypothesis:
Alternative hypothesis: H1:μ≠3190gH_1:\mu \ne 3190gH1:μ=3190g

1.2 Two type error

α error\alpha\ errorα error: H0H_0H0 is right but is rejected.
β error\beta\ errorβ error: H1H_1H1 is wrong but is accepted.

1.3 The procedure of hypothesis test

  1. raise hypothesis:
    H0:μ=3190gH_0:\mu=3190gH0:μ=3190g
    H1:μ≠3190gH_1:\mu \ne 3190gH1:μ=3190g
  2. statistics (σ\sigmaσ is known, sample > 30):
    z=xˉ−μ0σn=3210−319080/100=2.5z=\frac{\bar{x}-\mu_0}{\sigma\sqrt{n}}=\frac{3210-3190}{80/\sqrt{100}}=2.5z=σn xˉμ0=80/100 32103190=2.5
  3. zα2=±1.96<2.5z_{\frac{\alpha}{2}}=\pm1.96<2.5z2α=±1.96<2.5, zzz is in the critical region, so we reject H0H_0H0.

1.4 Test region

  1. two-tailed test:
    H0:μ=μ0H_0 :\mu=\mu_0H0
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值