BIOS14: ONE-WAY ANOVA(单因素方差分析) using R

这篇博客介绍了如何使用R进行单因素方差分析(ANOVA)及其后续检验,包括Kruskal-Wallis检验。内容涵盖了ANOVA的基本原理、假设,以及数据导入、模型构建、假设检验、结果解释等步骤,并通过具体实例演示了如何进行posthoc测试和计划对比。此外,还讨论了当ANOVA假设不成立时,如何使用Kruskal-Wallis非参数检验作为替代方法。

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

NOTES

1 Intruduction of ANOVA

1.1 terminology

If we have 4 groupps of samples, with mean μ 1 , μ 2 , μ 3 , μ 4 \mu_1, \mu_2, \mu_3, \mu_4 μ1,μ2,μ3,μ4, respectively. If we use t-test to test whether the means of 4 population are equle, we have to repeat 6 times t-test.
If all tests are made at some specified significance level (the possibility of error I α \alpha α), the overall level of 6 tests together will be 1 − ( 1 − α ) 6 = 0.625 > > 0.05 1-(1-\alpha)^6 = 0.625 >> 0.05 1(1α)6=0.625>>0.05.

Generally speaking, with the increase of the times of carrying on the significant test, the significant level will decrease.

ANOVA (analysis of variance) is used to test equality of multiple overall mean value.

Suppose we want to compare the quality of different industries according to the number of complaints received.

Here, the object be tested (diferent industries) is defined as factor, and the proformence of the factor(the number of complaints received) is defined as treatment. One-way anova means there are only one factor.

1.2 Principles and basic ideas

  1. describe with plot
    Using scatter plot to explore the data, and check the diference.
  2. error separation
    SST: Reflecting the error of all datas.
    SSE: Reflecting the with-in group error.
    SSA: Reflecting the group error.
  3. error analysis
    Analyse where the error comes from, with-in group or between group.

1.3 Assumption

  1. The populations are normal distributions.
  2. The populations have the same variance.
  3. observation is independent.

Typically:
H 0 : μ 1 = μ 2 = . . . = μ k H 1 : μ i ≠ μ j f o r   s o m e   p a i r ( i , j ) H_0: \mu_1=\mu_2=...=\mu_k \\ H_1: \mu_i \ne \mu_j\quad for\ some\ pair(i, j) H0:μ1=μ2=...=μkH1:μi=μjfor some pair(i,j)

Exrcise

Start by installing (if needed) and loading:

  • car
  • lmtest
  • multcomp

One-way anova analysis is used when we want to see if the mean of a continuous variable differs between groups (i.e. between levels of a single categorical variable, a.k.a. factor). It is a generalisation of the t-test, and can be applied to more than two groups. The significance of the categorical variable depends on the relationship between the wit

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值