第四章常用之统计分析程序
- 格式:pdf
- 大小:637.82 KB
- 文档页数:68
|p RB RSAS¤q o A X H q p n h M An O SAS/BASE¡A b T e d A UO SAS Language Guide P SAS Procedures Guide¡C L n p nSAS/STAT¡A SAS/IML¡A SAS/GRAPHµC SAS/STAT¬O M ip R n A o n GLM B ANOVA B CATMOD B NESTED¡B VARCOMP¡B MIXED¡B NPAR1WAY¡B TTEST P PLAN µO i iR CR(Analysis of Variance)¬O s A](Sources of Variation) ¥i(Effects)»P(Random error)¡A H N q(²p)¼N P]Y A M[H p(least-square)¤k p U CH U i i R GANOVA ¥i i]p(Balanced Designs) ¸R B hR(multivariate analysis) »P q R(analysis of variance for repeated measurement)C i H ih w(multiple comparison tests)¡C]p G U B z X(treatment combination)(experimental unit)¼P h]p A i H ANOVAµiR A i H P p C Y t OA w n GLMµA h G T CCATMOD H u X A M i R Pq R CGLM i R B k R B R B q R P hR C]p h E B w BU]w B u (linear contrast) »P p (estimate) ¶ih w P B CNESTED ¶i]p R P R C87NPAR1WAY i L R(nonparametric one-way analysis of rank scores)¡CPLAN P e(nested and crossed experiments) «]p P]p CTTEST ¤[CVARCOMP ¦p V X CR F test Àw B zµi O P Y Aw]Ho: µ1 =µ2 = µ3 = …=µt O T CANOVA P GLM ¦ MEANS ¥y¤l¥H¦UºØ¤£¦Pªº¤èªk(¨Ò¦p¡G Duncan’s¡B NMRT¡B LSD¡B Tukey’s HSD¡B SNK¡B Bonferroni¡B Scheffe ) U B z C]TEST y l w(Mean squares) t(Error mean square)¥H w U A]i R U]p(¦p]p)¡C1.PROC ANOVA options;CLASS variables;MODEL dependents = effects / options;ABSORT variables;BY variables;FREQ variables;MEANS effects / options;TEST H = effects E = effect;MANOVA H = effects E = effect M=equation2,…REPEATED factorname levels (levevalues) transformation [,..]/options;GCLASS variables;«Å§iÅܤè¤ÀªR¤ÀÃþªºÅܼÆ(classification variables)¡A¥¦¥²»Ý¦bMODEL¥y l H e X C o i H numeric¡A]i Hcharacter¡C p G CLASS BLOCK TRT¡CMODEL dependents = effects / options;88o O R p A M C ANOVAµuMODEL ¥y l C pB PROC ANOVA;CLASS BLOCK TRT;MODEL ADG BF=BLOCK TRT;G B PROC ANOVA;CLASS A B C;MODEL Y1 Y2 Y3 Y4=A B C B*C(»P Y1-Y4=A B|C;¬P)ABSORT variables;]l (blocking factor) «h level ®A p]l A i y l p P C p GPROC ANOVA;CLASS HERD A B;MODEL Y=HERD A B A*B;P U O PPROC ANOVA;ABSORT HERD;MODEL Y=A B A*B;ABSORT y l(sorting)¡A o i bMODEL¤X A B y b RUN ¥H e X CBY variables¡FFREQ variable¡FMEANS effects/options¡Fb CLASS ¥y l i X p P i Hy i C C ANOVA µi H MEANS ¥y l A B i b MODEL ¥y l e X C options¦GBON Bonferroni t testDUNCAN Duncan’s multiple-range testSCHEFFE Scheffe’s multiple comparisonSNK Student-Newman-Keul multiple range testT or LSD Least Significance Difference testTUKEY Tukey’s studentized range test (HSD)DUNNETT H DUNNETT test -n D B z P89A p GMEANS A/DUNNET(‘CONTROL)ALPHA w(level of significance)E = effect w t(error mean square)LINES n D p C A H u q X LtCLDIFF n D C X t H W UTEST H=effects E = effect¡FH S w(effect)¬t(error mean square)¦Y iF test¡C p]p(Split-plot design)¡CPROC ANOVA;CLASS A B C;MODEL Y=A|B(A)|C;TEST H=A E=B(A);TEST H=C A*C E=C*B(A);MANOVA H=effects E = effect M=equation1, equation2,…¡F MNAMES= list of names PREFIX =name/options;·MODEL¥y l(dependent variables)¬H W A y n D i MANOVA®A [(observation)-Y missing¡A h[N Q hQ R CREPEATED factorname levels (levevalues ) transformation [,..]/options¡F MODEL¥y[P q A p T I p P Y q A i y w Tt P t P P C90d G/* Example from Snedecor & Cochran, 1980. Statistical Methods, p216 */ DATA DOUGHNUT;INPUT TRT $ FAT @@;CARDS;1 642 783 754 551 72 2 913 934 661 682 973 784 491 772 823 714 641 562 853 634 701 952 773 764 68;PROC ANOVA;CLASS TRT;MODEL FAT=TRT;MEANS TRT;RUN;91G GThe SAS System 1 22:10 Tuesday, May 19, 1998Analysis of Variance ProcedureClass Level InformationClass Levels ValuesTRT 4 1 2 3 4Number of observations in data set = 24The SAS System 222:10 Tuesday, May 19, 1998Analysis of Variance ProcedureDependent Variable: FATSum of MeanSource DF Squares Square F Value Pr > FModel 3 1636.500000 545.500000 5.41 0.0069Error 20 2018.000000 100.900000Corrected Total 23 3654.500000R-Square C.V. Root MSE FAT Mean0.447804 13.62020 10.04490 73.75000Source DF Anova SS Mean Square F Value Pr > FTRT 3 1636.500000 545.500000 5.41 0.006992The SAS System 3 22:10 Tuesday, May 19, 1998Analysis of Variance ProcedureLevel of -------------FAT-------------TRT N Mean SD1 6 72.0000000 13.34166412 6 85.0000000 7.77174373 6 76.0000000 9.87927124 6 62.0000000 8.221921993d G G/* Example from Snedecor & Cochran, 1980. Statistical Methods, p251 */ DATA PIG;DO SIRE=1 TO 5;DO DAM=1 TO 2;DO PIG=1 TO 2;INPUT GAIN @@;OUTPUT;END;END;END;CARDS;2.77 2.382.58 2.942.28 2.223.01 2.612.36 2.712.72 2.742.87 2.462.31 2.242.74 2.562.50 2.48;PROC VARCOMP METHOD=TYPE1;CLASS SIRE DAM;MODEL GAIN=SIRE DAM(SIRE);TITLE ‘THREE STAGES WITH MIXED MODEL’;RUN;94G G*THREE STAGES WITH MIXED MODEL* 1 22:54 Tuesday, May 19, 1998Variance Components Estimation ProcedureClass Level InformationClass Levels ValuesSIRE 5 1 2 3 4 5DAM 2 1 2Number of observations in data set = 20*THREE STAGES WITH MIXED MODEL* 222:54 Tuesday, May 19, 1998Variance Components Estimation ProcedureDependent Variable: GAINSource DF Type I SS Type I MSSIRE 4 0.09973000 0.02493250DAM(SIRE) 5 0.56355000 0.11271000Error 10 0.38700000 0.03870000Corrected Total 19 1.0502800095Source Expected Mean SquareSIRE Var(Error) + 2 Var(DAM(SIRE)) + 4 Var(SIRE) DAM(SIRE) Var(Error) + 2 Var(DAM(SIRE))Error Var(Error)Variance Component EstimateVar(SIRE) -0.02194437Var(DAM(SIRE)) 0.03700500Var(Error) 0.0387000096d T G/* Example from John L. Gill, 1981, Design & Analysis of Experiments,p175 */OPTIONS LS=78 PS=60;DATA SPLIT;INPUT BLOCK 1 A 2 B 3 RESPONSE;CARDS;142 40.0141 39.5112 37.9111 35.4121 36.7122 38.2132 36.4131 34.8221 42.7222 41.6212 40.3211 41.6241 44.5242 47.6231 43.6232 42.8;PROC ANOVA;CLASS BLOCK A B;MODEL RESPONSE=BLOCK A BLOCK*A B A*B;TEST H=A E=BLOCK*A;TITLE’ SPLIT PLOT DESIGN’;RUN;97* SPLIT PLOT DESIGN* 3 13:58 Friday, May 22, 1998Analysis of Variance ProcedureClass Level InformationClass Levels ValuesBLOCK 2 1 2A 4 1 2 3 4B 2 1 2Number of observations in data set = 1698* SPLIT PLOT DESIGN* 413:58 Friday, May 22, 1998Analysis of Variance ProcedureDependent Variable: RESPONSESum of MeanSource DF Squares Square F Value Pr > F Model 11 182.0200000 16.5472727 7.85 0.0306 Error 4 8.4300000 2.1075000Corrected Total 15 190.4500000R-Square C.V. Root MSE RESPONSE Mean0.955736 3.609007 1.451723 40.22500 Source DF Anova SS Mean Square F Value Pr > FBLOCK 1 131.1025000 131.1025000 62.21 0.0014A 3 40.1900000 13.3966667 6.36 0.0530 BLOCK*A 3 6.9275000 2.3091667 1.10 0.4476B 1 2.2500000 2.2500000 1.07 0.3599A*B 3 1.5500000 0.5166667 0.25 0.8612 Tests of Hypotheses using the Anova MS for BLOCK*A as an error term Source DF Anova SS Mean Square F Value Pr > FA 3 40.19000000 13.39666667 5.80 0.0914992.PROC GLMGLM H p k(least square estimation)¤R u(General Linear Model)¡A]GLM¡C GSimple Regression model y=x1;Multiple Regression model y=x1 x2;Polynomial Regression model y=x1 x1*x1;Multivariate Regression model y1 y2= x1 x2;One-way ANOVA model y=a;Main Effects Model model y =a b c;Factorial Model (with interaction) model y=a b a*b;Nested Model model y=a b(a) c(b a);Multivariate Analysis of Variance model y1 y2=a b;Analysis-of-covariance Model model y=a x1;D n y l GPROC GLM; (»b MODEL¤e) CLASS variables; (»b MODEL¤e) MODEL dependents = independents / options; (¥n y l)(¥H U b RUN¤e)ABSORT variables;BY variables;FREQ variable;ID variables;WEIGHT variables;(¥H U i b MODEL¥y l a X)CONTRAST ‘label’ effect values…./options;ESTIMATE ‘label’ effect values…/options;LSMEANS effects/options;MANOVA H= effects E= effect M= equations….MNAMES= names PREFIX= name/options;MEANS effects / options;OUTPUT OUT= SASdataset keywords= names…;RANDOM effects/options;100REPEATED factorname levels (levevalues) transformation [,..]/options;TEST H= effects E= effect/options;GLMµS y l G1.CONTRAST : P w u A p GEx.1 CONTRAST ‘A LINEAR’ A -3 -1 1 3;Ex.2 CONTRAST ‘CONTROL vs. OTHERS’A 1 -0.2 -0.2 -0.2 -0.2 -0.2;Ex.3 CONTRAST ‘A LINEAR & QUADRATIC’A -3 -1 1 3, A 1 -1 -1 1;2.ESTIMATE : P p u A p GEx.1 ESTIMATE ‘B - S’ CROSS 1 1 1 1 1 1-1 -1 -1 -1 -1 -1/DIVISOR=6;Ex.2 ESTIMATE ‘B’ INTERCEPT 6 BLOCK 3 3 CROSS1 1 1 1 1 1 0 0 0 0 0 0/DIVISOR=6;3.LSMEANS effects/options:®p p p A p GEx.1 PROC GLM;CLASS A B;MODEL Y=A B A*B;LSMEANS A B A*B/STDERR PDIFF;options ¦GE L X p.(estimable functionsused)STDERR L X p t(S.E)PDIFF pE=effect w t101d G/* Example from Snedecor & Cochran, 1980. Statistical Methods, p230 */ DATA INJECT;INPUT TRT DOSE @@;CARDS;1 5234 34 8 511 92 6 4 34 8 561 112 22 4 38 8 621 132 27 4 40 8 631 142 27 4 46 8 701 162 28 4 58 8 731 172 28 4 60 8 761 202 37 4 60 8 891 22 2 40 4 65 8 921 282 421 312 501 31;PROC GLM;CLASS TRT;MODEL DOSE=TRT;MEANS TRT;TITLE ‘ ANALYSIS OF VARIANCE WITH UNBALANCED DATA’;RUN;102The SAS System 1 09:55 Wednesday, May 20, 1998General Linear Models ProcedureClass Level InformationClass Levels ValuesTRT 4 1 2 4 8Number of observations in data set = 41103The SAS System 2 09:55 Wednesday, May 20, 1998General Linear Models ProcedureDependent Variable: DOSESum of MeanSource DF Squares Square F Value Pr > FModel 3 16094.28166 5364.76055 35.13 0.0001Error 37 5650.10859 152.70564Corrected Total 40 21744.39024R-Square C.V. Root MSE DOSE Mean0.740158 31.78506 12.35741 38.87805 Source DF Type I SS Mean Square F Value Pr > F TRT 3 16094.28166 5364.76055 35.13 0.0001 Source DF Type III SS Mean Square F Value Pr > F TRT 3 16094.28166 5364.76055 35.13 0.0001104The SAS System 3 09:55 Wednesday, May 20, 1998General Linear Models ProcedureLevel of -------------DOSE------------TRT N Mean SD1 12 18.0833333 8.54356042 11 28.1818182 14.32353444 9 48.3333333 12.42980298 9 70.2222222 13.9622507105d G G/* Example from Snedecor & Cochran, 1980. Statistical Methods, p368 */ DATA LEPROSY;INPUT DRUG $ X Y @@;CARDS;A 11 6 A 8 0 A 19 11A 6 4 A 10 13 A 3 0D 6 0 D 6 2 D 18 18D 8 4 D 19 14 D 15 9F 16 13 F 13 10 F 21 23F 16 12 F 12 5 F 12 20;PROC GLM;CLASS DRUG;MODEL Y=DRUG X;LSMEANS DRUG/STDERR PDIFF;TITLE ‘ ANALYSIS OF COVARIANCE’;RUN;106G:The SAS System 1 10:14 Wednesday, May 20, 1998General Linear Models ProcedureClass Level InformationClass Levels ValuesDRUG 3 A D FNumber of observations in data set = 18107The SAS System 2 10:14 Wednesday, May 20, 1998General Linear Models ProcedureDependent Variable: YSum of MeanSource DF Squares Square F Value Pr > FModel 3 581.6768838 193.8922946 10.68 0.0006Error 14 254.1008940 18.1500639Corrected Total 17 835.7777778R-Square C.V. Root MSE Y Mean0.695971 46.75927 4.260289 9.111111Source DF Type I SS Mean Square F Value Pr > F DRUG 2 214.7777778 107.3888889 5.92 0.0137X 1 366.8991060 366.8991060 20.21 0.0005Source DF Type III SS Mean Square F Value Pr > F DRUG 2 30.5637001 15.2818501 0.84 0.4516X 1 366.8991060 366.8991060 20.21 0.0005108The SAS System 3 10:14 Wednesday, May 20, 1998General Linear Models ProcedureLeast Squares MeansDRUG Y Std Err Pr > |T| LSMEANLSMEAN LSMEAN H0:LSMEAN=0 NumberA 8.2481907 1.8315796 0.0005 1D 7.9946786 1.7396259 0.0004 2F 11.0904640 1.8431443 0.0001 3Pr > |T| H0: LSMEAN(i)=LSMEAN(j)i/j 1 2 31 . 0.9212 0.31542 0.9212 . 0.24363 0.3154 0.2436 .NOTE: To ensure overall protection level, only probabilities associated with pre-planned comparisons should be used.109d T G/* Example from Cole & Grizzle , 1966. */DATA DOGS;INPUT DRUG $ DEPL $ HIST0 HIST1 HIST3 HIST5;LHIST0=LOG(HIST0); LHIST1=LOG(HIST1);LHIST3=LOG(HIST3); LHIST5=LOG(HIST5);CARDS;MORPHINE N 0.04 0.20 0.10 0.08MORPHINE N 0.02 0.06 0.02 0.02MORPHINE N 0.07 1.40 0.48 0.24MORPHINE N 0.17 0.57 0.35 0.24MORPHINE Y 0.10 0.09 0.13 0.14MORPHINE Y 0.12 0.11 0.10 .MORPHINE Y 0.07 0.07 0.06 0.07MORPHINE Y 0.05 0.07 0.06 0.07TRIMETH N 0.03 0.62 0.31 0.22TRIMETH N 0.03 1.05 0.73 0.60TRIMETH N 0.07 0.83 1.07 0.80TRIMETH N 0.09 3.13 2.06 1.23TRIMETH Y 0.10 0.09 0.09 0.08TRIMETH Y 0.08 0.09 0.09 0.10TRIMETH Y 0.13 0.10 0.12 0.12TRIMETH Y 0.06 0.05 0.05 0.05;PROC GLM;CLASS DRUG DEPL;MODEL LHIST0 LHIST1 LHIST3 LHIST5=DRUG DEPL DRUG*DEPL/NOUNI; REPEATED TIME 4(0 1 3 5) POLYNOMIAL/SHORT SUMMARY;TITLE ‘ ANALYSIS OF VARIANCE FROM REPEARED OBSERVATIONS’; RUN;110G:* ANALYSIS OF VARIANCE FROM REPEARED OBSERVATIONS* 1 15:38 Wednesday, May 20, 1998General Linear Models ProcedureClass Level InformationClass Levels ValuesDRUG 2 MORPHINE TRIMETHDEPL 2 N YNumber of observations in data set = 16NOTE: Observations with missing values will not be included in this analysis. Thus, only 15 observations can be used in this analysis.111* ANALYSIS OF VARIANCE FROM REPEARED OBSERVATIONS* 2 15:38 Wednesday, May 20, 1998General Linear Models ProcedureRepeated Measures Analysis of VarianceRepeated Measures Level InformationDependent Variable LHIST0 LHIST1 LHIST3 LHIST5Level of TIME 0 1 3 5Manova Test Criteria and Exact F Statistics forthe Hypothesis of no TIME EffectH = Type III SS&CP Matrix for TIME E = Error SS&CP MatrixS=1 M=0.5 N=3.5Statistic Value F Num DF Den DF Pr > FWilks' Lambda 0.11097706 24.0326 3 9 0.0001 Pillai's Trace 0.88902294 24.0326 3 9 0.0001 Hotelling-Lawley Trace 8.01087137 24.0326 3 9 0.0001 Roy's Greatest Root 8.01087137 24.0326 3 9 0.0001112Manova Test Criteria and Exact F Statistics forthe Hypothesis of no TIME*DRUG EffectH = Type III SS&CP Matrix for TIME*DRUG E = Error SS&CP MatrixS=1 M=0.5 N=3.5Statistic Value F Num DF Den DF Pr > FWilks' Lambda 0.34155984 5.7832 3 9 0.0175 Pillai's Trace 0.65844016 5.7832 3 9 0.0175 Hotelling-Lawley Trace 1.92774470 5.7832 3 9 0.0175 Roy's Greatest Root 1.92774470 5.7832 3 9 0.0175Manova Test Criteria and Exact F Statistics forthe Hypothesis of no TIME*DEPL EffectH = Type III SS&CP Matrix for TIME*DEPL E = Error SS&CP Matrix S=1 M=0.5 N=3.5Statistic Value F Num DF Den DF Pr > FWilks' Lambda 0.12339988 21.3112 3 9 0.0002 Pillai's Trace 0.87660012 21.3112 3 9 0.0002 Hotelling-Lawley Trace 7.10373567 21.3112 3 9 0.0002 Roy's Greatest Root 7.10373567 21.3112 3 9 0.0002113* ANALYSIS OF VARIANCE FROM REPEARED OBSERVATIONS* 3 15:38 Wednesday, May 20, 1998General Linear Models ProcedureRepeated Measures Analysis of VarianceManova Test Criteria and Exact F Statistics forthe Hypothesis of no TIME*DRUG*DEPL EffectH = Type III SS&CP Matrix for TIME*DRUG*DEPL E = Error SS&CP MatrixS=1 M=0.5 N=3.5Statistic Value F Num DF Den DF Pr > FWilks' Lambda 0.19383010 12.4775 3 9 0.0015 Pillai's Trace 0.80616990 12.4775 3 9 0.0015 Hotelling-Lawley Trace 4.15915732 12.4775 3 9 0.0015 Roy's Greatest Root 4.15915732 12.4775 3 9 0.0015* ANALYSIS OF VARIANCE FROM REPEARED OBSERVATIONS* 4 15:38 Wednesday, May 20, 1998General Linear Models ProcedureRepeated Measures Analysis of VarianceTests of Hypotheses for Between Subjects EffectsSource DF Type III SS Mean Square F Value Pr > FDRUG 1 5.99336243 5.99336243 2.71 0.1281 DEPL 1 15.44840703 15.44840703 6.98 0.0229 DRUG*DEPL 1 4.69087508 4.69087508 2.12 0.1734Error 11 24.34683348 2.21334850114* ANALYSIS OF VARIANCE FROM REPEARED OBSERVATIONS* 5 15:38 Wednesday, May 20, 1998General Linear Models ProcedureRepeated Measures Analysis of VarianceUnivariate Tests of Hypotheses for Within Subject EffectsSource: TIMEAdj Pr > FDF Type III SS Mean Square F Value Pr > F G - G H - F 3 12.05898677 4.01966226 53.44 0.0001 0.0001 0.0001Source: TIME*DRUGAdj Pr > FDF Type III SS Mean Square F Value Pr > F G - G H - F 3 1.84429514 0.61476505 8.17 0.0003 0.0039 0.0008Source: TIME*DEPLAdj Pr > FDF Type III SS Mean Square F Value Pr > F G - G H - F 3 12.08978557 4.02992852 53.57 0.0001 0.0001 0.0001Source: TIME*DRUG*DEPLAdj Pr > FDF Type III SS Mean Square F Value Pr > F G - G H - F 3 2.93077939 0.97692646 12.99 0.0001 0.0005 0.0001Source: Error(TIME)DF Type III SS Mean Square33 2.48238887 0.07522391Greenhouse-Geisser Epsilon = 0.5694Huynh-Feldt Epsilon = 0.8475115* ANALYSIS OF VARIANCE FROM REPEARED OBSERVATIONS* 6 15:38 Wednesday, May 20, 1998General Linear Models ProcedureRepeated Measures Analysis of VarianceAnalysis of Variance of Contrast VariablesTIME.N represents the nth degree polynomial contrast for TIMEContrast Variable: TIME.1Source DF Type III SS Mean Square F Value Pr > FMEAN 1 2.00963483 2.00963483 34.99 0.0001 DRUG 1 1.18069076 1.18069076 20.56 0.0009 DEPL 1 1.36172504 1.36172504 23.71 0.0005 DRUG*DEPL 1 2.04346848 2.04346848 35.58 0.0001Error 11 0.63171161 0.05742833Contrast Variable: TIME.2Source DF Type III SS Mean Square F Value Pr > FMEAN 1 5.40988418 5.40988418 57.15 0.0001 DRUG 1 0.59173192 0.59173192 6.25 0.0295 DEPL 1 5.94945506 5.94945506 62.86 0.0001 DRUG*DEPL 1 0.67031587 0.67031587 7.08 0.0221Error 11 1.04118707 0.09465337Contrast Variable: TIME.3Source DF Type III SS Mean Square F Value Pr > FMEAN 1 4.63946776 4.63946776 63.04 0.0001116DRUG 1 0.07187246 0.07187246 0.98 0.3443 DEPL 1 4.77860547 4.77860547 64.94 0.0001 DRUG*DEPL 1 0.21699504 0.21699504 2.95 0.1139Error 11 0.80949018 0.073590021173.PROC MIXEDMIXED F u A H N o ip R A W MIXED «O]t T w P CD n]A A G A B(©T w P)¬O u Y A p k M k(restricted maximum likelihood, REML)©M k(maximum likelihood, ML)C pGβ+εγyX=Z+D n y l GPROC MIXED <options>; (»b MODEL¤e) BY variables;CLASS variables; (»b MODEL¤e)ID variables;MODEL dependents = < fixed-effects> </ options>; (¥n y l)RANDOM random-effect </options>;REPEATED <repeated-effect> </ options>;PRIOR <distribution> </ options>;CONTRAST ‘label’ <fixed-effect values…>< | random-effect values…..>,…</ options>;ESTIMATE <fixed-effect values…>< | random-effect values…..> </ options>;LSMEANS fixed-effects </ options>;MAKE ‘table’ OUT=SAS-data-set;WEIGHT variable;118d G*---------------Repeated Measures Example-----------* | Data represent a repeated measures example where | | an unstructured variance matrix is fit. Data are || from Pothoff and Roy (1964) and are analyzed by | | Jennrich and Schluchter (1986). |*---------------------------------------------------*;data pr;input person sex$y1 y2 y3 y4;y=y1; age=8; output;y=y2; age=10; output;y=y3; age=12; output;y=y4; age=14; output;drop y1-y4;datalines;1 F 21.0 20.0 21.5 23.02 F 21.0 21.5 24.0 25.53 F 20.5 24.0 24.5 26.04 F 23.5 24.5 25.0 26.55 F 21.5 23.0 22.5 23.56 F 20.0 21.0 21.0 22.57 F 21.5 22.5 23.0 25.08 F 23.0 23.0 23.5 24.09 F 20.0 21.0 22.0 21.510 F 16.5 19.0 19.0 19.511 F 24.5 25.0 28.0 28.012 M 26.0 25.0 29.0 31.013 M 21.5 22.5 23.0 26.514 M 23.0 22.5 24.0 27.515 M 25.5 27.5 26.5 27.016 M 20.0 23.5 22.5 26.017 M 24.5 25.5 27.0 28.518 M 22.0 22.0 24.5 26.519 M 24.0 21.5 24.5 25.520 M 23.0 20.5 31.0 26.021 M 27.5 28.0 31.0 31.522 M 23.0 23.0 23.5 25.023 M 21.5 23.5 24.0 28.024 M 17.0 24.5 26.0 29.525 M 22.5 25.5 25.5 26.026 M 23.0 24.5 26.0 30.027 M 22.0 21.5 23.5 25.0;/* unstructured variance matrix */119proc mixed data=pr method=ml;class person sex;model y = sex age(sex) / noint s;repeated / type=un sub=person r;run;/* random coefficients model */proc mixed data=pr method=ml;class person sex;model y = sex age(sex) / noint s;random intercept age / type=un sub=person g;run;/* compound symmetry */proc mixed data=pr method=ml;class person sex;model y = sex age(sex) / noint s;repeated / type=cs sub=person r;run;/* compound symmetry specified on RANDOM statement */ proc mixed data=pr method=ml;class person sex;model y = sex age(sex) / noint s;random person;run;/* compound symmetry with heterogeneity across sex */ proc mixed data=pr method=ml;class person sex;model y = sex age(sex) / noint s;repeated / type=cs sub=person group=sex;run;/* first-order autoregressive */proc mixed data=pr method=ml;class person sex;model y = sex age(sex) / noint s;repeated / type=ar(1) sub=person;run;120T he SAS Syst em 11:01 Tues day, A pri l 8, 2003 50 The Mixed ProcedureModel InformationData Set WORK.PRDependent Variable yCovariance Structure UnstructuredSubj e ct Effect personEstimation Method MLResidual Variance Method NoneFixed Effects SE Method Model-BasedDegrees of Freedom Method Between-WithinClass Level InformationClass Levels Valuesperson 27 1 2 3 4 5 6 7 8 9 10 11 12 1314 15 16 17 18 19 20 21 22 2324 25 26 27sex 2 F MIteration HistoryIteration Evaluations -2 Log Like Criterion0 1 478.241759861 2 419.47721707 0.000001522 1 419.47704812 0.00000000Convergence criteria met.Th e SAS Syste m 11:01 Tu esd ay, April8, 2003 51 The Mixed ProcedureEstimated R Matrix for person 1Row Col1 Col2 Col3 Col41 5.1192 2.4409 3.6105 2.52222 2.4409 3.9279 2.7175 3.06243 3.6105 2.7175 5.9798 3.82354 2.5222 3.0624 3.8235 4.6180Covariance Parameter EstimatesCov Parm Subj e ct EstimateUN(1,1) person 5.1192UN(2,1) person 2.4409121UN(2,2) person 3.9279UN(3,1) person 3.6105UN(3,2) person 2.7175UN(3,3) person 5.9798UN(4,1) person 2.5222UN(4,2) person 3.0624UN(4,3) person 3.8235UN(4,4) person 4.6180Fit Statistics-2 Log Likelihood 419.5AIC (smaller is better) 447.5AICC (smaller is better) 452.0BIC (smaller is better) 465.6Null Model Likelihood Ratio TestDF Chi-Square Pr > Chi Sq9 58.76 <.0001Solution for Fixed EffectsStandardEffect sex Estimate Error DF t Value Pr > |t|sex F 17.4254 1.1284 25 15.44 <.0001sex M 15.8423 0.9356 25 16.93 <.0001age(sex) F 0.4764 0.09541 25 4.99 <.0001age(sex) M 0.8268 0.07911 25 10.45 <.0001The SAS System 11:01 Tue sda y, Apr il8,2003 52 The Mixed ProcedureType 3 Tests of Fixed EffectsNum DenEffect DF DF F Value Pr > Fsex 2 25 262.60 <.0001age(sex) 2 25 67.07 <.0001Th e SAS Syste m 11:01 Tu esd ay, April8, 2003 53 The Mixed ProcedureModel InformationData Set WORK.PRDependent Variable yCovariance Structure UnstructuredSubj e ct Effect personEstimation Method ML122Residual Variance Method ProfileFixed Effects SE Method Model-BasedDegrees of Freedom Method ContainmentClass Level InformationClass Levels Valuesperson 27 1 2 3 4 5 6 7 8 9 10 11 12 1314 15 16 17 18 19 20 21 22 2324 25 26 27sex 2 F MDimensionsCovariance Parameters 4Columns in X 4Columns in Z Per Subj e ct 2Subj e cts 27Max Obs Per Subj e ct 4Observations Used 108Observations Not Used 0Total Observations 108Iteration HistoryIteration Evaluations -2 Log Like Criterion0 1 478.241759861 1 427.80595080 0.00000000Convergence criteria met.Th e SAS Syste m 11:01 Tu esd ay, April8, 2003 54The Mixed ProcedureEstimated G MatrixRow Effect person Col1 Col21 Intercept 1 4.5569 -0.19832 age 1 -0.1983 0.02376Covariance Parameter EstimatesCov Parm Subj e ct EstimateUN(1,1) person 4.5569UN(2,1) person -0.1983UN(2,2) person 0.02376Residual 1.7162123Fit Statistics-2 Log Likelihood 427.8AIC (smaller is better) 443.8AICC (smaller is better) 445.3BIC (smaller is better) 454.2Null Model Likelihood Ratio TestDF Chi-Square Pr > Chi Sq3 50.44 <.0001Solution for Fixed EffectsStandardEffect sex Estimate Error DF t Value Pr > |t|sex F 17.3727 1.1820 54 14.70 <.0001sex M 16.3406 0.9801 54 16.67 <.0001age(sex) F 0.4795 0.09980 54 4.80 <.0001age(sex) M 0.7844 0.08275 54 9.48 <.0001Th e SAS Syste m 11:01 Tu esd ay, April8, 2003 55The Mixed ProcedureType 3 Tests of Fixed EffectsNum DenEffect DF DF F Value Pr > Fsex 2 54 247.00 <.0001age(sex) 2 54 56.46 <.0001Th e SAS Syste m 11:01 Tu esd ay, April8, 2003 56The Mixed ProcedureModel InformationData Set WORK.PRDependent Variable yCovariance Structure Compound Symme trySubj e ct Effect personEstimation Method MLResidual Variance Method ProfileFixed Effects SE Method Model-BasedDegrees of Freedom Method Between-WithinClass Level InformationClass Levels Valuesperson 27 1 2 3 4 5 6 7 8 9 10 11 12 1314 15 16 17 18 19 20 21 22 2324 25 26 27sex 2 F M124DimensionsCovariance Parameters 2Columns in X 4Columns in Z0Subj e cts 27Max Obs Per Subj e ct 4Observations Used 108Observations Not Used 0Total Observations 108Iteration HistoryIteration Evaluations -2 Log Like Criterion0 1 478.241759861 1 428.63905802 0.00000000Convergence criteria met.Th e SAS Syste m 11:01 Tu esd ay, April8, 2003 57 The Mixed ProcedureEstimated R Matrix for person 1Row Col1 Col2 Col3 Col41 4.9052 3.0306 3.0306 3.03062 3.0306 4.9052 3.0306 3.03063 3.0306 3.0306 4.9052 3.03064 3.0306 3.0306 3.0306 4.9052Covariance Parameter EstimatesCov Parm Subj e ct EstimateCS person 3.0306Residual 1.8746Fit Statistics-2 Log Likelihood 428.6AIC (smaller is better) 440.6AICC (smaller is better) 441.5BIC (smaller is better) 448.4Null Model Likelihood Ratio TestDF Chi-Square Pr > Chi Sq1 49.60 <.0001125。