1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
55
56 /* RepeatedMonkey.sas */
57 title 'Primate hippocampal function: Zola-Morgan and Squire, 1990';
58 title2 'Covariance Structure approach to repeated measures (within-cases)';
59
60 data memory;
61 infile '/folders/myfolders/monkey.data.txt' firstobs=2;
62 input monkey $ treatment $ week2 week4 week8 week12 week16;
63 /* Make 5 "cases" in the data set for each line in the raw data file.
64 The output command generates a case. */
65 id = _n_;
66 time = 2; score = week2; output;
67 time = 4; score = week4; output;
68 time = 8; score = week8; output;
69 time = 12; score = week12; output;
70 time = 16; score = week16; output;
71 keep monkey treatment id time score;
72
NOTE: The infile '/folders/myfolders/monkey.data.txt' is:
Filename=/folders/myfolders/monkey.data.txt,
Owner Name=root,Group Name=vboxsf,
Access Permission=-rwxrwx---,
Last Modified=13Mar2016:09:26:31,
File Size (bytes)=854
NOTE: 18 records were read from the infile '/folders/myfolders/monkey.data.txt'.
The minimum record length was 42.
The maximum record length was 42.
NOTE: The data set WORK.MEMORY has 90 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.02 seconds
73 proc print;
74
NOTE: There were 90 observations read from the data set WORK.MEMORY.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.15 seconds
cpu time 0.15 seconds
75 proc freq;
76 tables time*treatment /norow nocol nopercent;
77 tables monkey;
78
NOTE: There were 90 observations read from the data set WORK.MEMORY.
NOTE: PROCEDURE FREQ used (Total process time):
real time 0.07 seconds
cpu time 0.07 seconds
79 proc mixed cl;
80 title3 'Unstructured Covariance Matrix';
81 class treatment time;
82 model score = treatment|time;
83 repeated / type=un subject=id r;
84 /* Could have used subject=monkey, but then monkey must be declared in
85 class because it's character-valued. */
86
87 /* We did not reject the null hypothesis that observations from the
88 same subject are independent. Try an ordinary 2-way ANOVA, mostly
89 for the interaction plot. */
90
NOTE: Convergence criteria met.
NOTE: PROCEDURE MIXED used (Total process time):
real time 0.12 seconds
cpu time 0.11 seconds
91 proc glm;
92 title3 'Ordinary 2-way';
93 class time treatment; /* This order determines the plot. */
94 model score = treatment|time;
95
96 /* Could justify compound symmetry: Each monkey brings her own special talent
97 for discrimination learning. */
98
NOTE: PROCEDURE GLM used (Total process time):
real time 0.70 seconds
cpu time 0.21 seconds
99 proc mixed cl;
100 title3 'Compound Symmetry';
101 class treatment time;
102 model score = treatment|time;
103 repeated / type=cs subject=id r;
104
105 /* Contrast statements to follow up the interaction are possible
106 but challenging. */
107
108
NOTE: Convergence criteria met.
NOTE: PROCEDURE MIXED used (Total process time):
real time 0.10 seconds
cpu time 0.08 seconds
109 proc glm;
110 title3 'Classical (Same results as CS)';
111 class treatment time monkey;
112 model score = treatment|time monkey(treatment);
113 random monkey(treatment) / test;
114
115 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
127