狠狠撸

狠狠撸Share a Scribd company logo
SAS tutorial: GLM (2)
Repeated measures
? 如果每個參與者都作了某些作業/回答某
  些題目。
? 那麼這些題目/作業便稱為重複量數
  (repeated measures)。
 – 或受試者內(within subject)設計。


? 可以去除來自個體差異的variance。
Example:
   2-way repeated ANOVA
Source   SS df   MS   F
A                     A / (S*A)
B                     B / (S*B)
A*B                   A*B / (S*A*B)
S
S*A
            Error
S*B
S*A*B
GLM for repeated measures
data aaa;       datalines;
do S= 1 to 3;   5 10 20 10
do A=1 to 2;    6 11 22 13
do B=1 to 2;    4 12 24 9
input x @@;     ;
output;
end;
end;
end;
GLM for repeated measures:
           code
Between             Between
ods graphics on;    proc glm data=AAA;
proc glm data=AAA   class A B S;
plots=intplot;      model x=A|B|S;
class A B;          test h=A e=A*S;
model x=A|B;        test h=B e=B*S;
run;                test h=A*B e=A*B*S;
ods graphics off;   run;
Result (between) :
 Interaction plot
Result (between)
Result (within)



          DF 被model用完了,
          沒有error可以除?
Result




Between
Mix models
? 有些變項是受試者內設計,有些變項是受
  试者间设计。
Example
? 16 dogs
? Dependent variable:
  – log-histamine concentration
? Independent variables:
  – Drug: morphine or trimethaphan (between)
  – Depleted: Y or N (between)
  – Time: measured after 0, 1, 3, or 5 min (within)
Code
data dogs;                                           Morphine    Y .07 .07 .06 .07
   input Drug $ Depleted $ Histamine0 Histamine1     Morphine    Y .05 .07 .06 .07
       Histamine3 Histamine5;                        Trimethaphan N .03 .62 .31 .22
   LogHistamine0=log(Histamine0);                    Trimethaphan N .03 1.05 .73 .60
   LogHistamine1=log(Histamine1);                    Trimethaphan N .07 .83 1.07 .80
   LogHistamine3=log(Histamine3);                    Trimethaphan N .09 3.13 2.06 1.23
   LogHistamine5=log(Histamine5);                    Trimethaphan Y .10 .09 .09 .08
   datalines;                                        Trimethaphan Y .08 .09 .09 .10
 Morphine     N .04 .20 .10 .08                      Trimethaphan Y .13 .10 .12 .12
 Morphine     N .02 .06 .02 .02                      Trimethaphan Y .06 .05 .05 .05
 Morphine     N .07 1.40 .48 .24                     ;
 Morphine     N .17 .57 .35 .24
 Morphine     Y .10 .09 .13 .14
 Morphine     Y .12 .11 .10 .           Missing    data 不用
proc glm;                          先寫betwwen,再寫within
    class Drug Depleted;
    model LogHistamine0--LogHistamine5 =
        Drug Depleted Drug*Depleted / nouni;
    repeated Time 4 (0 1 3 5) polynomial / summary printe;
  run;
Result
Result




         檢驗Y在獨變項不同水準下
         的差異值變異數是否相同。
Ad

Recommended

PDF
Programme du 24 mars
mantoan
?
PPTX
Bases de dato
Diego Aramndo rueda
?
DOC
UML2ClearQuest. ClearQuest ALM schema report
Alexander Novichkov
?
PDF
Phospholipid Vescicles As A Model System For Biomineralization
Jimmy
?
PDF
Mulder obdam voor K3
NW360 Vastgoedontwikkeling
?
PPTX
Presentación gold
Daniielaa Chacon
?
PDF
Reiq Business Luncheon 狠狠撸 Presentation
LJ Gilland Real Estate Pty Ltd
?
ODP
Bioc strucvariant seattle_11_09
Sean Davis
?
PDF
Preso smc030 guerilla small
Martijn Arets
?
PPT
Op zoek naar het erg kleine: zien van atomen
UnescoCentrum
?
PDF
Presentatie olivier marktplaats media event 2010
Marketingfacts
?
PPSX
Prijsvraagontwerp cultureel centrum pius x volendam april 2000
edwin I van der waal
?
PDF
CS I.4 - H.G. van Liempd
IAU_Past_Conferences
?
DOCX
Results for questionnaire
jacquesASmedia
?
PPT
Open vlacc UGent20110929
Rosa Matthys
?
PPTX
Smart Architect 7steps to Transform
UBM_Design_Central
?
PPTX
Practica 10 (1)
christian199898
?
PPT
Manoj Gangwar Brief Insight
manojkgangwar
?
PPTX
Developing Product & Services
Joe Kinsella
?
PPTX
futureNo52
WenSheng Chang
?
PPTX
Sas plot
WenSheng Chang
?
PPTX
Sas reg multi
WenSheng Chang
?
PPTX
Sas reg simple
WenSheng Chang
?
PPTX
Sas corr
WenSheng Chang
?
PPTX
1129 sas實習課
WenSheng Chang
?
PPTX
Sas tutorial 1018
WenSheng Chang
?
PPTX
Sas tutorial 0524
WenSheng Chang
?
PPTX
Sas tutorial glm1
WenSheng Chang
?

More Related Content

Viewers also liked (13)

PDF
Preso smc030 guerilla small
Martijn Arets
?
PPT
Op zoek naar het erg kleine: zien van atomen
UnescoCentrum
?
PDF
Presentatie olivier marktplaats media event 2010
Marketingfacts
?
PPSX
Prijsvraagontwerp cultureel centrum pius x volendam april 2000
edwin I van der waal
?
PDF
CS I.4 - H.G. van Liempd
IAU_Past_Conferences
?
DOCX
Results for questionnaire
jacquesASmedia
?
PPT
Open vlacc UGent20110929
Rosa Matthys
?
PPTX
Smart Architect 7steps to Transform
UBM_Design_Central
?
PPTX
Practica 10 (1)
christian199898
?
PPT
Manoj Gangwar Brief Insight
manojkgangwar
?
PPTX
Developing Product & Services
Joe Kinsella
?
Preso smc030 guerilla small
Martijn Arets
?
Op zoek naar het erg kleine: zien van atomen
UnescoCentrum
?
Presentatie olivier marktplaats media event 2010
Marketingfacts
?
Prijsvraagontwerp cultureel centrum pius x volendam april 2000
edwin I van der waal
?
CS I.4 - H.G. van Liempd
IAU_Past_Conferences
?
Results for questionnaire
jacquesASmedia
?
Open vlacc UGent20110929
Rosa Matthys
?
Smart Architect 7steps to Transform
UBM_Design_Central
?
Practica 10 (1)
christian199898
?
Manoj Gangwar Brief Insight
manojkgangwar
?
Developing Product & Services
Joe Kinsella
?

More from WenSheng Chang (15)

PPTX
futureNo52
WenSheng Chang
?
PPTX
Sas plot
WenSheng Chang
?
PPTX
Sas reg multi
WenSheng Chang
?
PPTX
Sas reg simple
WenSheng Chang
?
PPTX
Sas corr
WenSheng Chang
?
PPTX
1129 sas實習課
WenSheng Chang
?
PPTX
Sas tutorial 1018
WenSheng Chang
?
PPTX
Sas tutorial 0524
WenSheng Chang
?
PPTX
Sas tutorial glm1
WenSheng Chang
?
PPTX
Regression ci
WenSheng Chang
?
PPTX
SAS 0412
WenSheng Chang
?
PPTX
Sas tutorial 0308
WenSheng Chang
?
PPTX
Sas tutorial 0308
WenSheng Chang
?
PPT
0925 sas實習課
WenSheng Chang
?
PDF
Science p79 -- polished
WenSheng Chang
?
futureNo52
WenSheng Chang
?
Sas reg multi
WenSheng Chang
?
Sas reg simple
WenSheng Chang
?
1129 sas實習課
WenSheng Chang
?
Sas tutorial 1018
WenSheng Chang
?
Sas tutorial 0524
WenSheng Chang
?
Sas tutorial glm1
WenSheng Chang
?
Regression ci
WenSheng Chang
?
Sas tutorial 0308
WenSheng Chang
?
Sas tutorial 0308
WenSheng Chang
?
0925 sas實習課
WenSheng Chang
?
Science p79 -- polished
WenSheng Chang
?
Ad

Sas tutorial glm2

  • 2. Repeated measures ? 如果每個參與者都作了某些作業/回答某 些題目。 ? 那麼這些題目/作業便稱為重複量數 (repeated measures)。 – 或受試者內(within subject)設計。 ? 可以去除來自個體差異的variance。
  • 3. Example: 2-way repeated ANOVA Source SS df MS F A A / (S*A) B B / (S*B) A*B A*B / (S*A*B) S S*A Error S*B S*A*B
  • 4. GLM for repeated measures data aaa; datalines; do S= 1 to 3; 5 10 20 10 do A=1 to 2; 6 11 22 13 do B=1 to 2; 4 12 24 9 input x @@; ; output; end; end; end;
  • 5. GLM for repeated measures: code Between Between ods graphics on; proc glm data=AAA; proc glm data=AAA class A B S; plots=intplot; model x=A|B|S; class A B; test h=A e=A*S; model x=A|B; test h=B e=B*S; run; test h=A*B e=A*B*S; ods graphics off; run;
  • 6. Result (between) : Interaction plot
  • 8. Result (within) DF 被model用完了, 沒有error可以除?
  • 11. Example ? 16 dogs ? Dependent variable: – log-histamine concentration ? Independent variables: – Drug: morphine or trimethaphan (between) – Depleted: Y or N (between) – Time: measured after 0, 1, 3, or 5 min (within)
  • 12. Code data dogs; Morphine Y .07 .07 .06 .07 input Drug $ Depleted $ Histamine0 Histamine1 Morphine Y .05 .07 .06 .07 Histamine3 Histamine5; Trimethaphan N .03 .62 .31 .22 LogHistamine0=log(Histamine0); Trimethaphan N .03 1.05 .73 .60 LogHistamine1=log(Histamine1); Trimethaphan N .07 .83 1.07 .80 LogHistamine3=log(Histamine3); Trimethaphan N .09 3.13 2.06 1.23 LogHistamine5=log(Histamine5); Trimethaphan Y .10 .09 .09 .08 datalines; Trimethaphan Y .08 .09 .09 .10 Morphine N .04 .20 .10 .08 Trimethaphan Y .13 .10 .12 .12 Morphine N .02 .06 .02 .02 Trimethaphan Y .06 .05 .05 .05 Morphine N .07 1.40 .48 .24 ; Morphine N .17 .57 .35 .24 Morphine Y .10 .09 .13 .14 Morphine Y .12 .11 .10 . Missing data 不用 proc glm; 先寫betwwen,再寫within class Drug Depleted; model LogHistamine0--LogHistamine5 = Drug Depleted Drug*Depleted / nouni; repeated Time 4 (0 1 3 5) polynomial / summary printe; run;
  • 14. Result 檢驗Y在獨變項不同水準下 的差異值變異數是否相同。