/* ReactionTime2.sas */ title "Ana's Perception Study: Reaction Time"; title2 'Repeated Measures with proc mixed'; /* Read data from Excel spreadsheet */ proc import datafile="/folders/myfolders/2453f15/RT_Medians.xls" out=rtime1 dbms=xls replace; getnames=yes; data rtime2; /* Convert to univariate data format */ /* Number of cases = number of reaction times */ /* output creates a new case. */ set rtime1; length sentencetype $ 11; /* Default is 8 characters */ context = 'None'; sentencetype = 'Question'; rtime = NCQ; output; context = 'None'; sentencetype = 'Exclamation'; rtime = NCE; output; context = 'None'; sentencetype = 'Statement'; rtime = NCS; output; context = 'Low'; sentencetype = 'Question'; rtime = LCQ; output; context = 'Low'; sentencetype = 'Exclamation'; rtime = LCE; output; context = 'Low'; sentencetype = 'Statement'; rtime = LCS; output; context = 'Full'; sentencetype = 'Question'; rtime = CQ; output; context = 'Full'; sentencetype = 'Exclamation'; rtime = CE; output; context = 'Full'; sentencetype = 'Statement'; rtime = CS; output; label rtime = 'Median Reaction Time'; keep Participant Language context sentencetype rtime; proc print; run; proc mixed; title3 'All Three Tasks'; class Language Context SentenceType Participant; model rtime = Language|Context|SentenceType; repeated / type=cs subject=Participant r; /* r means give the estimated within-case covariance matrix */ lsmeans Language|Context|SentenceType; /* Again, set Full context aside and analyze separately. */ proc mixed; title3 'Just no context and low context'; where Context ne 'Full'; /* So easy */ class Language Context SentenceType Participant; model rtime = Language|Context|SentenceType; repeated / type=cs subject=Participant; lsmeans Context|SentenceType; /* Selected after looking at results */ proc mixed; title3 'Full context only: Langrage by Sentence Type'; where Context = 'Full'; class Language SentenceType Participant; model rtime = Language|SentenceType; repeated / type=cs subject=Participant; lsmeans SentenceType / pdiff adjust=bon; /* Selected after looking at results */ /* Try to replicate that last result with a mixed model */ proc mixed; title3 'A true mixed (nested) model'; where Context = 'Full'; class Language SentenceType Participant; model rtime = Language|SentenceType; random participant(Language); /* Note random effects are not specified in the model statement. */