1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
55
56 /* ReactionTime2.sas */
57 title "Ana's Perception Study: Reaction Time";
58 title2 'Repeated Measures with proc mixed';
59
60
61 /* Read data from Excel spreadsheet */
62 proc import datafile="/folders/myfolders/2453f15/RT_Medians.xls"
63 out=rtime1 dbms=xls replace;
64 getnames=yes;
65
66
NOTE: The import data set has 30 observations and 11 variables.
NOTE: WORK.RTIME1 data set was successfully created.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.02 seconds
cpu time 0.01 seconds
67 data rtime2; /* Convert to univariate data format */
68 /* Number of cases = number of reaction times */
69 /* output creates a new case. */
70 set rtime1;
71 length sentencetype $ 11; /* Default is 8 characters */
72 context = 'None'; sentencetype = 'Question'; rtime = NCQ; output;
73 context = 'None'; sentencetype = 'Exclamation'; rtime = NCE; output;
74 context = 'None'; sentencetype = 'Statement'; rtime = NCS; output;
75
76 context = 'Low'; sentencetype = 'Question'; rtime = LCQ; output;
77 context = 'Low'; sentencetype = 'Exclamation'; rtime = LCE; output;
78 context = 'Low'; sentencetype = 'Statement'; rtime = LCS; output;
79
80 context = 'Full'; sentencetype = 'Question'; rtime = CQ; output;
81 context = 'Full'; sentencetype = 'Exclamation'; rtime = CE; output;
82 context = 'Full'; sentencetype = 'Statement'; rtime = CS; output;
83
84 label rtime= 'Median Reaction Time';
85 keep Participant Language context sentencetype rtime;
86
NOTE: There were 30 observations read from the data set WORK.RTIME1.
NOTE: The data set WORK.RTIME2 has 270 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.05 seconds
cpu time 0.05 seconds
87 proc print;
88 run;
NOTE: There were 270 observations read from the data set WORK.RTIME2.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.67 seconds
cpu time 0.67 seconds
89
90 proc mixed;
91 title3 'All Three Tasks';
92 class Language Context SentenceType Participant;
93 model rtime = Language|Context|SentenceType;
94 repeated / type=cs subject=Participant r;
95 /* r means give the estimated within-case covariance matrix */
96 lsmeans Language|Context|SentenceType;
97
98 /* Again, set Full context aside and analyze separately. */
99
NOTE: 4 observations are not included because of missing values.
NOTE: Convergence criteria met.
NOTE: PROCEDURE MIXED used (Total process time):
real time 0.39 seconds
cpu time 0.37 seconds
100 proc mixed;
101 title3 'Just no context and low context';
102 where Context ne 'Full'; /* So easy */
103 class Language Context SentenceType Participant;
104 model rtime = Language|Context|SentenceType;
105 repeated / type=cs subject=Participant;
106 lsmeans Context|SentenceType; /* Selected after looking at results */
107
NOTE: 1 observation is not included because of missing values.
NOTE: Convergence criteria met.
NOTE: PROCEDURE MIXED used (Total process time):
real time 0.19 seconds
cpu time 0.19 seconds
108 proc mixed;
109 title3 'Full context only: Langrage by Sentence Type';
110 where Context = 'Full';
111 class Language SentenceType Participant;
112 model rtime = Language|SentenceType;
113 repeated / type=cs subject=Participant;
114 lsmeans SentenceType / pdiff adjust=bon; /* Selected after looking at results */
115
116 /* Try to replicate that last result with a mixed model */
117
NOTE: 3 observations are not included because of missing values.
NOTE: Convergence criteria met.
NOTE: PROCEDURE MIXED used (Total process time):
real time 0.19 seconds
cpu time 0.18 seconds
118 proc mixed;
119 title3 'A true mixed (nested) model';
120 where Context = 'Full';
121 class Language SentenceType Participant;
122 model rtime = Language|SentenceType;
123 random participant(Language);
124
125 /* Note random effects are not specified in the model statement. */
126
127
128
129 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
141