📜  单向方差分析

📅  最后修改于: 2022-05-13 01:58:06.815000             🧑  作者: Mango

单向方差分析

方差分析是一种参数统计技术,有助于找出三个或更多组的平均值之间是否存在显着差异。它通过根据各自的平均值比较组(样本)来检查各种因素的影响。

我们只能在以下情况下使用它:

  • 样本服从正态分布。
  • 样本是随机选择的,应该是相互独立的。
  • 所有组都有相同的标准差。

单向方差分析

它是一种假设检验,其中只考虑一个因素。我们使用 F 统计量来执行单向方差分析。



涉及步骤

Step 1 - Define the null and alternative hypothesis. 

H0 -> μ1 = μ2 = μ3 (where μ = mean)
Ha -> At least one difference among the means.
Step 2 - Find the degree of freedom between and within the groups. [Using Eq-1 and Eq-2]
     Then find total degree of freedom. [Using Eq-3]

等式 1

where k = number of groups. 

等式2

where 
n = number of samples in all groups combined.
k = number of groups. 

方程 3

下一步,我们需要了解什么是 F 统计量。

F值:定义为样本间方差与样本内方差的比值。它是在执行 ANOVA 测试时获得的。等式 4显示了单向方差分析的 F 值公式。

方程 – 4

Step 3 - Refer the F-Distribution table and find Ftable using dfbetween and dfwithin. 
As per the given F-Distribution table,  
    df1 = dfbetween
    df2 = dfwithin 
[use the given value of α while referring the table.]
Step 4 - Find the mean of all samples in each group. 
 Then use Eq-5 to find the Grand mean. (μGrand)

方程 – 5



where,
∑G = sum of all sample values.
n = number of samples.
Step 5 - Find the sum of squares total using Eq-6 and sum of squares within using Eq-7.
     Then find sum of squares between using Eq-8.

等式 6

where, xi = ith sample

方程 7

where, 
xi = ith sample.
μi = mean of ith group. 

方程 8

Step 6 - Find the variance (μ2 or S2) between and within samples using Eq-9 and Eq-10.

等式 9

方程 10

Step 7 - Find Fcalc using Eq-11. 

方程 11

解释结果

if Fcalc < Ftable :
    Don't rejct null hypothesis.
    μ1 = μ2 = μ3
    
if Fcalc > Ftable :
    Reject null hypothesis.

示例问题

考虑下面给出的示例,以逐步了解如何执行此测试。记录一组学生的 3 个科目(满分 5 分)的分数。 (如下表所示)
[取α = 0.05]

Std/SubEnglish (e)Math (m)Science (s)
Student 1

2

2



1

Student 2

4

3

2

Student 3

2

4

5

Step 1 -
Null hypothesis,      H0 -> μE = μM = μS (where μ = mean)
Alternate hypothesis, Ha -> At least one difference among the means of the 3 subjects.
Step 2 -
As per the table, 
k = 3
n = 9
dfbetween = 3 - 1 = 2 [Eq-1]
dfwithin = 9 - 3 = 6  [Eq-2]
dftotal = 2 + 6 = 8  [Eq-3]
Step 3 - On referring to the F-Distribution table (link), using df1 = 2 
 and df2 = 6 at α = 0.05: we get, Ftable = 5.14
Step 4 - μe = (2 + 4 + 2)/3 = (8/3) = 2.67
       μm = (2 + 3 + 4)/3 = (9/3) = 3.00
     μs = (1 + 2 + 5)/3 = (8/3) = 2.67
 
      μgrand = (8 + 8 + 9)/9 = (25/9) = 2.78
Step 5 - SStotal =  (2 - 2.78)2 + (4 - 2.78)2 + (2 - 2.78)2 +
            (2 - 2.78)2 + (3 - 2.78)2 + (4 - 2.78)2 +
            (1 - 2.78)2 + (2 - 2.78)2 + (5 - 2.78)2 
             = 13.60
      
     SSwithin = (2 - 2.67)2 + (4 - 2.67)2 + (2 - 2.67)2 +
           (2 - 3.00)2 + (3 - 3.00)2 + (4 - 3.00)2 +
           (1 - 2.67)2 + (2 - 2.67)2 + (5 - 2.67)2  
             = 13.34
    
    SSbetween = 13.60 - 13.34 = 0.23
Step 6 - S2between = (0.23/2) = 0.12 
     S2within = (13.34/6) = 2.22
Step 7 - Fcalc = (0.12/2.22) = 0.05 
Since, Fcalc < Ftable (0.05 < 5.14)
    we cannot reject the null hypothesis. 

因此,我们可以说所有三个科目的均值是相同的。

单向方差分析比较三个或三个以上的分类组以确定它们之间是否存在差异。方差分析的基本策略是系统地检查被比较组内的变异性,并检查被比较组之间的变异性。如有任何疑问/疑问,请在下方评论。