* chapter_15_table_1 We revisit the McCarthy data from Table 11.5 in Chapter 15. Notice, however, that when using PROC MIXED, the data needs to be entered differently when we analyzed it earlier using PROC GLM. Rather than having N columns by p number of timepoints, PROC MIXED requires the data to be entered in N*p rows, with a column identifying the participant and the timepoint. Included below is the data set of Chapter 11.5 in the format required by PROC MIXED. Because Chapter 15 provides all of the SAS syntax necessary to replicate the results given in the chapter, and because explanations of the syntax is also given in the text, most of the code given below is taken directly from the chapter without explanations of the commands and optional specifications. Note the data structure necessary is different that used up to this point. PROC GLM has different data set-up requirements when compared to the procedures used up to this point. We will input the data directly as is discussed on page 715 of the text. ; DATA c15t1; INPUT id timecat iq; time = timecat-30; CARDS; *Datalines can also be used instead of CARDS; 1 30 108 1 36 96 1 42 110 1 48 122 2 30 103 2 36 117 2 42 127 2 48 133 3 30 96 3 36 107 3 42 106 3 48 107 4 30 84 4 36 85 4 42 92 4 48 99 5 30 118 5 36 125 5 42 125 5 48 116 6 30 110 6 36 107 6 42 96 6 48 91 7 30 129 7 36 128 7 42 123 7 48 128 8 30 90 8 36 84 8 42 101 8 48 113 9 30 84 9 36 104 9 42 100 9 48 88 10 30 96 10 36 100 10 42 103 10 48 105 11 30 105 11 36 114 11 42 105 11 48 112 12 30 113 12 36 117 12 42 132 12 48 130 ; TITLE 'Replication of Table 15.2'; PROC GLM; CLASS timecat id; MODEL iq = id timecat / SOLUTION; LSMEANS ID TIMECAT; RUN; PROC MIXED; CLASS timecat; MODEL iq=timecat / SOLUTION; RANDOM int / SUBJECT=id; RUN; TITLE 'Replication of Table 15.4'; PROC MIXED COVTEST CL; CLASS timecat; MODEL iq=timecat / SOLUTION; RANDOM int time / SUBJECT=id TYPE=UN; RUN; TITLE 'Replication of Table 15.5'; PROC MIXED; CLASS timecat; MODEL iq=timecat / SOLUTION DDFM=SATTERTH; RANDOM int time / SUBJECT=id TYPE=UN; CONTRAST 'Time Main Effect' timecat 1 -1 0 0, timecat 0 1 -1 0, timecat 0 0 1 -1; CONTRAST 'Time Linear' timecat -3 -1 1 3; CONTRAST 'Time Quad' timecat 1 -1 -1 1; CONTRAST 'Time Cubic' timecat -1 3 -3 1; RUN; TITLE 'Replication of Table 15.6'; PROC MIXED COVTEST CL; MODEL iq=time / SOLUTION; RANDOM int time / SUBJECT=id TYPE=UN GCORR; RUN; TITLE 'Replication of Table 15.10'; PROC MIXED; CLASS timecat; MODEL iq=timecat / SOLUTION; REPEATED / SUBJECT=id TYPE=un HLM HLPS RCORR; RUN; TITLE 'Replication of Table 15.11'; PROC MIXED; CLASS timecat; MODEL iq=timecat / SOLUTION; REPEATED / SUBJECT=id TYPE=CS RCORR; RUN; TITLE 'Replication of Table 15.12'; PROC MIXED; CLASS timecat; MODEL iq=timecat / SOLUTION; REPEATED / SUBJECT=id TYPE=AR(1) RCORR; RUN;