Re: [程式] SAS two-way repeated measure ANOVA
我不知道是否SAS版本的問題
你的codes我只花了一瞬間就執行完畢
例如,其中的一部分結果如下:
Univariate Tests of Hypotheses for Within Subject Effects
Source DF Type III SS Mean Square F Value
Pr> Adj Pr>F
F G - G H-F-L
day 3 1064.500687 354.833562 192.06
<.0001 <.0001 <.0001
day*A 3 12.526328 4.175443 2.26
0.0896 0.1069 0.0991
day*B 3 90.000687 30.000229 16.24
<.0001 <.0001 <.0001
day*A*B 3 25.410943 8.470314 4.58
0.0056 0.0111 0.0083
Error(day) 66 121.934524 1.847493
關於你另外一個帖子提到two-way anova的HOV test問題,我看到有人是這樣做的,
就是另外生成一個新的combo=A*2+B
這樣,combo就相當於一個4-level的variable(0 1 2 3)
然後就可以用這個combo來做一個one-way ANOVA,目的是單純的檢查HOV
不過,回到這個實際的數據上面,你的model並非2因子試驗,而是3因子試驗
只是其中有一個是within factor:day而已,
而在使用proc glm的時候,實際是使用了一種multivariate的方法
這時候會報告兩種結果,一種是MANOVA,另外一種是Univariate Tests
這兩種結果有時一致,有時可能會有差異,
其實,它們差異的原因乃是assumption的不用
Univariate Tests的assumption就是你迫切想要test的Homogeneous of variance
而MAONVA的前提,則不僅僅不是HOV,甚至連covariance都不需要homogeneous
它是把這些variance都納入了model的考量之内了。
所以,採用哪種方法,其實是具體看數據,
univariate的model當然最好,因爲model最簡化
所以,看起來違反了前提,其實還有前提更松的方法可以使用
當然代價是model的複雜性
其實不管是repeated measure anova 還是MAONVA,都只是multilevel model
(或者叫mixed model, hierarchical linear model等等)的一個特例而已
我們常用的repeated measure anova(指univariate的那種)
就是假定variance matrix是一種compound symmetry的結構
而MANOVA的model,則是假定variance matrix是一種unstruture的結構
這兩者一個最簡化,一個最複雜,而中間還有很多種可能性
最後,在你所寫的codes的基礎之上,我提供另外一個方法
就是用了multilevel model
你可以觀察一下data是如何組織的,相對於你用的
multivariate的數據形式
我這種是univariate的數據形式
當然本質上是一樣的數據
data bac_long;set bac;
time=1;y=d1;output;
time=2;y=d2;output;
time=3;y=d3;output;
time=4;y=d4;output;
drop d1-d4;
run;
proc mixed data=bac_long;
class a b time id;
model y=a b time a*b a*time b*time a*b*time /s;
repreated time/ subject=id r type=cs;
run;
(type=cs:compound symmetry,所以這個model就是
有兩個between factors的repeated measure ANOVA)
※ 引述《anovachen ( )》之銘言:
: [軟體程式類別]:
: SAS 9.3
: [程式問題]:
: two-way repeated measure ANOVA
: 使用proc glm出現警告訊息
: [軟體熟悉度]:
: 高(1年以上)
: [問題敘述]:
: 警告訊息如下:
: NOTE: The Huynh-Feldt epsilon and the corresponding adjusted p-value have
: been enhanced to
: include a correction based on Lecoutre (1991). Use the UEPSDEF=HF
: option on the REPEATED
: statement to revert to the previous definition.
: 之後程式會一直無法結束...
: 直到按下Break鍵才能強迫中斷。
: [程式範例]:
: data bac;
: input id group $ A $ B $ d1 d2 d3 d4;
: cards;
: 1 Con N N 1 3 4 5
: ...略
: 11 A Y N 2 3 4 5
: ...略
: 21 B N Y 2 2 3 3
: ...略
: 31 AB Y Y 1 2 3 4
: ...略
: ;
: proc glm data=bac;
: class A B;
: model d1-d4=A B A*B / nouni;
: repeated day 4 /summary printe ;
: run;
: 即使加入UEPSDEF=CM或=HF都還是有同樣的問題(程式無法結束)。
: 只是警告訊息會消失而已= =
: -----------------------------------------------------------------------------
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 129.93.112.57
※ 編輯: BugEater 來自: 129.93.112.57 (10/20 15:41)
※ 編輯: BugEater 來自: 129.93.112.57 (10/20 15:44)
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):