# 方差分析(2) —— 双因子方差分析及Excel示例

2 篇文章 1 订阅

### 无重复双因子方差分析

x ˉ 1 ⋅ = ∑ j x 1 j k , x ˉ 2 ⋅ = ∑ j x 2 j k , . . . , x ˉ r ⋅ = ∑ j x r j k , ( j = 1 , 2 , . . . , k ) \bar{x}_{1·}=\frac{\sum_{j}{x_{1j}}}{k}, \bar{x}_{2·}=\frac{\sum_{j}{x_{2j}}}{k}, ..., \bar{x}_{r·}=\frac{\sum_{j}{x_{rj}}}{k}, (j=1,2,...,k)

#### 偏差平方和及自由度

S S T = ∑ j = 1 k ∑ i = 1 r ( x i j − x ˉ ˉ ) 2 , SS_T = \sum_{j=1}^{k}{\sum_{i=1}^{r}{(x_{ij}-\bar{\bar{x}})^2}}, 自由度为 d f T = k r − 1 df_T=kr-1 .

S S A = ∑ j = 1 k ∑ i = 1 r ( x ˉ i ⋅ − x ˉ ˉ ) 2 = k ∑ i = 1 r ( x ˉ i ⋅ − x ˉ ˉ ) 2 , SS_A = \sum_{j=1}^{k}{\sum_{i=1}^{r}{(\bar{x}_{i·}-\bar{\bar{x}})^2}} =k{\sum_{i=1}^{r}{(\bar{x}_{i·}-\bar{\bar{x}})^2}}, 自由度为 d f A = r − 1 df_A=r-1 .

S S B = ∑ j = 1 k ∑ i = 1 r ( x ˉ ⋅ j − x ˉ ˉ ) 2 = ∑ j = 1 k r ( x ˉ ⋅ j − x ˉ ˉ ) 2 , SS_B = \sum_{j=1}^{k}{\sum_{i=1}^{r}{(\bar{x}_{·j}-\bar{\bar{x}})^2}} ={\sum_{j=1}^{k}{r(\bar{x}_{·j}-\bar{\bar{x}})^2}}, 自由度为 k − 1 k-1 .

S S e = ∑ j = 1 k ∑ i = 1 r ( x i j − x ˉ i ⋅ − x ˉ ⋅ j + x ˉ ˉ ) 2 , SS_e = \sum_{j=1}^{k}{\sum_{i=1}^{r}{(x_{ij}-\bar{x}_{i·}-\bar{x}_{·j} +\bar{\bar{x}})^2}}, 自由度为 d f e = ( k − 1 ) ( r − 1 ) df_e=(k-1)(r-1) .

S S T = S S A + S S B + S S e SS_T= SS_A+SS_B+SS_e

### 可重复双因子方差分析

x 112 x_{112} x 122 x_{122} . . . ... x 1 k 2 x_{1k2}
. . . ... . . . ... . . . ... . . . ...
x 11 p x_{11p} x 12 p x_{12p} . . . ... x 1 k p x_{1kp}

x 212 x_{212} x 222 x_{222} . . . ... x 2 k 2 x_{2k2}
. . . ... . . . ... . . . ... . . . ...
x 21 p x_{21p} x 22 p x_{22p} . . . ... x 2 k p x_{2kp}

. . . ... . . . ... . . . ... . . . ... . . . ... . . . ...

x r 12 x_{r12} x r 22 x_{r22} . . . ... x r k 2 x_{rk2}
. . . ... . . . ... . . . ... . . . ...
x r 1 p x_{r1p} x r 2 p x_{r2p} . . . ... x r k p x_{rkp}

• 所有 r ∗ k ∗ p r*k*p 个数据的平均：
x ˉ ˉ = 1 r k p ∑ i = 1 r ∑ j = 1 k ∑ m = 1 p x i j m \bar{\bar{x}} = \frac{1}{rkp}{\sum_{i=1}^{r}\sum_{j=1}^{k}\sum_{m=1}^{p}{x_{ijm}}}

• A i A_i , B j B_j 条件下, p p 次重复的平均：
x ˉ i j ⋅ = 1 p ∑ m = 1 p x i j m , e g : x ˉ 11 ⋅ = 1 p ∑ m = 1 p x 11 m ， x ˉ 12 ⋅ = 1 p ∑ m = 1 p x 12 m \bar{x}_{ij·} = \frac{1}{p}{\sum_{m=1}^{p}{x_{ijm}}} , \\ eg: \bar{x}_{11·} = \frac{1}{p}{\sum_{m=1}^{p}{x_{11m}}} ， \bar{x}_{12·} = \frac{1}{p}{\sum_{m=1}^{p}{x_{12m}}}

• A i A_i 条件下， k ∗ p k*p 个数据的平均:
x ˉ i ⋅ ⋅ = 1 k p ∑ j = 1 k ∑ m = 1 p x i j m , e g : x ˉ 1 ⋅ ⋅ = 1 k p ∑ j = 1 k ∑ m = 1 p x 1 j m ,   x ˉ 2 ⋅ ⋅ = 1 k p ∑ j = 1 k ∑ m = 1 p x 2 j m \bar{x}_{i··} = \frac{1}{kp}{\sum_{j=1}^{k}\sum_{m=1}^{p}{x_{ijm}}}, \\ eg: \bar{x}_{1··} = \frac{1}{kp}{\sum_{j=1}^{k}\sum_{m=1}^{p}{x_{1jm}}}, \ \bar{x}_{2··} = \frac{1}{kp}{\sum_{j=1}^{k}\sum_{m=1}^{p}{x_{2jm}}}

• B j B_j 条件下， r ∗ p r*p 个数据的平均：
x ˉ ⋅ j ⋅ = 1 r p ∑ i = 1 r ∑ m = 1 p x i j m , e g : x ˉ ⋅ 1 ⋅ = 1 r p ∑ i = 1 r ∑ m = 1 p x i 1 m ,   x ˉ ⋅ 2 ⋅ = 1 r p ∑ i = 1 r ∑ m = 1 p x i 2 m \bar{x}_{·j·} = \frac{1}{rp}{\sum_{i=1}^{r}\sum_{m=1}^{p}{x_{ijm}}}, \\ eg: \bar{x}_{·1·} = \frac{1}{rp}{\sum_{i=1}^{r}\sum_{m=1}^{p}{x_{i1m}}}, \ \bar{x}_{·2·} = \frac{1}{rp}{\sum_{i=1}^{r}\sum_{m=1}^{p}{x_{i2m}}}

#### 偏差平方和及自由度

S S T = ∑ i = 1 r ∑ j = 1 k ∑ m = 1 p ( x i j m − x ˉ ˉ ) 2 ,   自 由 度 d f T = r k p − 1 SS_T = {\sum_{i=1}^{r}\sum_{j=1}^{k}\sum_{m=1}^{p}{(x_{ijm} - \bar{\bar{x}})^2}}, \ 自由度df_T = rkp -1

S S A = ∑ i = 1 r ∑ j = 1 k ∑ m = 1 p ( x i ⋅ ⋅ − x ˉ ˉ ) 2 = k p ∑ i = 1 r ( x i ⋅ ⋅ − x ˉ ˉ ) 2 SS_A = {\sum_{i=1}^{r}\sum_{j=1}^{k}\sum_{m=1}^{p}{(x_{i··} - \bar{\bar{x}})^2}} =kp\sum_{i=1}^{r}(x_{i··} - \bar{\bar{x}})^2

S S B = ∑ i = 1 r ∑ j = 1 k ∑ m = 1 p ( x ⋅ j ⋅ − x ˉ ˉ ) 2 = r p ∑ j = 1 k ( x ⋅ j ⋅ − x ˉ ˉ ) 2 , SS_B = {\sum_{i=1}^{r}\sum_{j=1}^{k}\sum_{m=1}^{p}{(x_{·j·} - \bar{\bar{x}})^2}} =rp\sum_{j=1}^{k}{(x_{·j·} - \bar{\bar{x}})^2},

S S e = ∑ i = 1 r ∑ j = 1 k ∑ m = 1 p ( x i j m − x ˉ i j ⋅ ) 2 , SS_e = {\sum_{i=1}^{r}\sum_{j=1}^{k}\sum_{m=1}^{p}{(x_{ijm} - \bar{x}_{ij·})^2}},

S S A B = S S T − S S A − S S B = ∑ i = 1 r ∑ j = 1 k ∑ m = 1 p [ ( x ˉ ˉ + x ˉ i j ⋅ ) − ( x i ⋅ ⋅ + x ⋅ j ⋅ ) ] 2 , SS_{AB} = SS_T - SS_A -SS_B = \sum_{i=1}^{r}\sum_{j=1}^{k}\sum_{m=1}^{p}[(\bar{\bar{x}} + \bar{x}_{ij·}) - (x_{i··} + x_{·j·}) ]^2,

#### 重复双因子方差分析表

S S E = S S A B + S S e , SS_E = SS_{AB} + SS_e,

F A = M S A / M S E , p = F α ( d f A , d f E ) ; F B = M S B / M S E , p = F α ( d f B , d f E ) . F_A= MS_A / MS_E, p = F_\alpha(df_A, df_E); \\ F_B = MS_B / MS_E, p = F_\alpha(df_B, df_E).

### Excel表中示例

Excel版本： Microsoft Office 2016

#### 无重复双因子示例

1. 选择"数据分析" - "无重复双因素方差分析"工具：
（其中行为因子A对应的数据，列为因子B对应的数据）
2. 选择数据，指定置信水平 α \alpha 值，默认0.05，指定输出结果区域：
3. 上一步确定后生成分析结果：

上面结果中，差异源行列误差分别对应的是因子 A A ，因子 B B 和随机误差 e e 的信息。各列中SS即为对应偏差平方和，df为对应自由度，MS为对应均方，F为对应 F F 值，P-value 为对应 p p 值，F-crit F F 临界值。
• 对于 p p 值，也可用Excel中的函数 =F.DIST.RT({F_value},df1,df2) 得到。
• 对于 F F 临界值，也可用 =F.INV(1-{alpha},df1,df2)得到：

#### 可重复双因子示例

1. 类似无重复双因子方差分析，选择"可重复上因素分析"工具：

2. 选择数据，填写"样本行数"（示例中对因子A进行3次重复）、置信水平和输出区域：

3. 上一步确定后，生成如下结果：
上面结果中，差异源样本列交互内部分别对应的是因子 A A ，因子 B B A B AB 交互影响和随机误差 e e 的信息。各列中SS即为对应偏差平方和，df为对应自由度，MS为对应均方，F为对应 F F 值，P-value 为对应 p p 值，F-crit F F 临界值。

与无重复双因子方差分析相同，其 p p 值和 F F 临界值也可通过Excel中函数得到： =F.DIST.RT({F_value},df1,df2)=F.INV(1-{alpha},df1,df2)

2019-07- 26

• 1
点赞
• 0
评论
• 22
收藏
• 一键三连
• 扫一扫，分享海报

12-17 3944

02-08 2004
12-16 4283
03-31 919
09-27 1万+
12-12 664
03-16 799
12-04 2037
05-10 5521
05-22 2643
02-24 2万+
04-12 4413
06-17 7464