I need your help in defining the right SAS code for my statistical model.
I have repeated measures design with four levels: 12 subjects performed four different tasks ("task" variable with four levels - baseline, task1, task2, task3), Each task was repeated 10 times ("trial"). I measured their performance and want to know if their performance (dv) is significantly different for these four levels. My code is
proc mixed data=....;
class subject task trial;
model dv = task ;
repeated task /Subject=Subject Type=CS R RCorr;
Could you tell me please if my model is right? My concern is about "trial" variable. Should I change my code to take it into account or it is enough to have it in the class statement?
TRIAL is not in the MODEL statement, so TRIAL will not be included in the specification of the fixed effects component of your model.
TRIAL is not in a RANDOM or REPEATED statement, so TRIAL will not be included in the specification of the random effects component of your model.
Thus, TRIAL is not a factor in the model as you have specified it.
By putting TRIAL in the CLASS statement, the only impact on your analysis will be the deletion from the analysis of any observation for which TRIAL is missing.
I don't know what the appropriate model is for your study because it is not clear to me how TRIAL figures into the design. Did each subject do baseline, then task1, then task2, then task3 and subsequently repeated that sequence 10 times? Or did each subject do baseline 10 times, then task1 10 times, etc.?
Is the task sequence the same for each subject, or is this study a crossover (e.g., latin square) design? (If the design is not a crossover, should it have been?)
It is latin square design for "task". Subjects repeated each task 10 times: e.g., subject #1 did 10 times task1, then 10 times task3, 10 times baseline, and 10 times task2.
Based on what you wrote, I don't have any trouble with my model, do I?
If you have no interest in how a subject's response might change over the 10 trials, then you could consider computing a summary statistic (e.g., a mean) that is appropriate for the response and then using the summary statistic as data in the analysis.
Alternatively you could set up a multilevel model to accommodate these "subsamples."
If you *are* interested in how a subject's response might change of the 10 trials (e.g., some sort of learning process) then you need to incorporate TRIAL into your model as a repeated measure. This model would be complex because you'd have the repeated measures for TRIAL nested within the repeated measures for TASK, all within a latin square/crossover design.
Regarding the latin square design: With 4 treatments there are 24 possible sequences. Given that you have 12 subjects, I assume that each subject received a different sequence.
IF each subject received a different sequence and
IF you have no clustering of subjects (e.g., subjects were not blocked into 3 groups of 4 subjects) and
IF it is appropriate to assume that there are no carry-over effects and
IF the multiple TRIAL measures have been summarized into a single statistic for analysis,
then a simple specification of your model could be
model dv = task period;
model dv = task period;
repeated treat / subject=subject type=cs;
Note the addition of PERIOD (of which you have 4 levels) to the model. If any of the IFs listed above are not met, then the model would need to be modified.
Each subject is measured (in 10 trials) in each of 4 PERIODs. For each subject, each PERIOD is associated with a different TASK. The overall test of PERIOD assesses whether all PERIODs have the same mean DV.
Your question suggests to me that you may not be very familiar with latin square/crossover designs. If that is so, then I in turn suggest that you spend some time learning more about them. Studies applying multiple treatments to the same experimental unit can be much trickier to design and to analyze than one might think initially.