當今天處理組中含有多項因素時要如何以統計方法比較不同因素對觀測值的影響力呢?
有個統計方法是正交比較(Orthogonal contrast) ,這個方法也是種可以簡化試驗數量的方式
網路上有許多舉例這裡就不贅舉了
下方連結是正交試驗的介紹還有例子唷
http://wiki.mbalib.com/zh-tw/%E6%AD%A3%E4%BA%A4%E8%AF%95%E9%AA%8C%E8%AE%BE%E8%AE%A1
進入正題
- 使用五種不同飼料添加劑,對於土雞蛋重影響;請以變方分析討論添加劑間對蛋重影響,並以LSD方法較處理組間平均值差異的顯著性。
- 若將添加劑歸類,其中添加劑A含I、II、III、IV類胺基酸;添加劑B含I、II、III類胺基酸;添加劑C含I、II類胺基酸;添加劑D含I、III類胺基酸;添加劑E含II類胺基酸,請依添加劑分類,利用正交比較(Orthogonal contrast),討論胺基酸對蛋重影響。
A |
37 |
32 |
31 |
46 |
44 |
38 |
36 |
33 |
40 |
33 |
B |
49 |
43 |
52 |
52 |
50 |
53 |
46 |
42 |
56 |
57 |
C |
43 |
33 |
48 |
45 |
46 |
42 |
46 |
40 |
44 |
43 |
D |
47 |
41 |
54 |
49 |
44 |
52 |
46 |
45 |
54 |
38 |
E |
40 |
31 |
44 |
34 |
44 |
36 |
51 |
43 |
37 |
40 |
Ans:
先做出正交試驗表,因素(factor)為4(I、II、II、IV);水平(level)為5(添加劑A~E)。(1代表含有該胺基酸;0則沒有)
Level Factor |
I |
II |
III |
IV |
A |
1 |
1 |
1 |
1 |
B |
1 |
1 |
1 |
0 |
C |
1 |
1 |
0 |
0 |
D |
1 |
0 |
1 |
0 |
E |
0 |
1 |
0 |
0 |
Data Aminoacid;
do feed = 1to 5; /*輸入五組後換下一欄*/
input egg @@;
output;
end;
cards;
37 49 43 47 40
32 43 33 41 31
31 52 48 54 44
46 52 45 49 34
44 50 46 44 44
38 53 42 52 36
36 46 46 46 51
33 42 40 45 43
40 56 44 54 37
33 47 43 38 40
;
proc sort;
by feed;
proc glm data= Aminoacid;
class feed;
model egg=feed;
means feed /lsd;
lsmeans feed/ stderr pdiff;
/* 下面開始是正交比較的語法,要會比就在於先找出哪一種胺基酸只有哪一種添加劑含有或沒有(像是胺基酸I只有添加劑E沒有);如果該胺基酸不是只有只出現在某一種添加劑,則需要抓兩個甚至以上來比(像是胺基酸III在添加劑C和E沒有,另外三種添加劑含有)*/
/*另一個原則是比較方係數為正且和另一方(負數)相合須為0,如CE vs ABD時,CE係數要相等且和ABD的係數相合為0,因此CE係數各為3,ABD各為-2)*/
*type-oder---------------------------feedA feedB feedC feedD feedE;
contrast 'feedE vs others' feed -1 -1 -1 -1 4 ; /* 胺基酸I影響(只有添加劑E沒有胺基酸I)*/
contrast 'feedD vs others' feed -1 -1 -1 4 -1 ; /* 胺基酸II影響(只有添加劑D沒有胺基酸II)*/
contrast 'feedCE vs feedABD' feed -2 -2 3 -2 3 ; /* 胺基酸III影響,添加劑CE都沒有胺基酸III,所以跟添加劑ABD比較*/
contrast 'feedA vs others' feed 4 -1 -1 -1 -1 ; /* 胺基酸IV影響(只有添加劑A有胺基酸IV)*/
run;
輸出結果
The SAS System
The GLM Procedure
Class Level Information |
|
|
Class |
Levels |
Values |
feed |
5 |
1 2 3 4 5 |
Number of Observations Read |
50 |
Number of Observations Used |
50 |
The SAS System
The GLM Procedure
Dependent Variable: egg
Source |
DF |
Sum of Squares |
Mean Square |
F Value |
Pr > F |
Model |
4 |
968.000000 |
242.000000 |
9.59 |
<.0001 |
Error |
45 |
1136.000000 |
25.244444 |
|
|
Corrected Total |
49 |
2104.000000 |
|
|
|
R-Square |
Coeff Var |
Root MSE |
egg Mean |
0.460076 |
11.63052 |
5.024385 |
43.20000 |
Source |
DF |
Type I SS |
Mean Square |
F Value |
Pr > F |
feed |
4 |
968.0000000 |
242.0000000 |
9.59 |
<.0001 |
Source |
DF |
Type III SS |
Mean Square |
F Value |
Pr > F |
feed |
4 |
968.0000000 |
242.0000000 |
9.59 |
<.0001 |
The SAS System
The GLM Procedure
The SAS System
The GLM Procedure
t Tests (LSD) for egg
Note: |
This test controls the Type I comparisonwise error rate, not the experimentwise error rate. |
Alpha |
0.05 |
Error Degrees of Freedom |
45 |
Error Mean Square |
25.24444 |
Critical Value of t |
2.01410 |
Least Significant Difference |
4.5256 |
Means with the same letter are not significantly different. |
|
|
|
|
t Grouping |
|
Mean |
N |
feed |
|
A |
49.000 |
10 |
2 |
|
A |
|
|
|
B |
A |
47.000 |
10 |
4 |
B |
|
|
|
|
B |
C |
43.000 |
10 |
3 |
|
C |
|
|
|
D |
C |
40.000 |
10 |
5 |
D |
|
|
|
|
D |
|
37.000 |
10 |
1 |
解釋一下上表(以LSD跑出來的),大寫字母出現在同一列的代表是同一組,也就是沒有顯著差異
A代表添加劑B(2);B代表添加劑D(4)
他們並列於第三列,也就是這兩組被歸類在同一組,亦即不顯著
但A跟C沒有並列,所以添加劑B(2)跟添加劑C(3)有顯著差異
The SAS System
The GLM Procedure
Least Squares Means
feed |
egg LSMEAN |
Standard Error |
Pr > |t| |
LSMEAN Number |
1 |
37.0000000 |
1.5888500 |
<.0001 |
1 |
2 |
49.0000000 |
1.5888500 |
<.0001 |
2 |
3 |
43.0000000 |
1.5888500 |
<.0001 |
3 |
4 |
47.0000000 |
1.5888500 |
<.0001 |
4 |
5 |
40.0000000 |
1.5888500 |
<.0001 |
5 |
Least Squares Means for effect feed Pr > |t| for H0: LSMean(i)=LSMean(j) Dependent Variable: egg |
|
|
|
|
|
i/j |
1 |
2 |
3 |
4 |
5 |
1 |
|
<.0001 |
0.0105 |
<.0001 |
0.1885 |
2 |
<.0001 |
|
0.0105 |
0.3782 |
0.0002 |
3 |
0.0105 |
0.0105 |
|
0.0818 |
0.1885 |
4 |
<.0001 |
0.3782 |
0.0818 |
|
0.0032 |
5 |
0.1885 |
0.0002 |
0.1885 |
0.0032 |
|
Note: |
To ensure overall protection level, only probabilities associated with pre-planned comparisons should be used. |
The SAS System
The GLM Procedure
Dependent Variable: egg
Contrast |
DF |
Contrast SS |
Mean Square |
F Value |
Pr > F |
feedE vs others |
1 |
128.0000000 |
128.0000000 |
5.07 |
0.0293 |
feedD vs others |
1 |
180.5000000 |
180.5000000 |
7.15 |
0.0104 |
feedCE vs feedABD |
1 |
96.3333333 |
96.3333333 |
3.82 |
0.0570 |
feedA vs others |
1 |
480.5000000 |
480.5000000 |
19.03 |
<.0001 |
F值越大代表該因素影響越大,所以從正交比較結果看胺基酸種類對蛋重的影響程度為 IV>II>I>III