title 'Repeated measures: Balanced vs. Unbalanced data'; *-----------------------------------------------------------* | This example is a three-factor experiment with repeated | | measures on one factor from Winer (1971, p. 564) on data | | from a study by Meyer and Noble (1958). The experiment | | evaluated errors on four learning trials as a function of | | high and low levels of manifest anxiety and two levels of | | muscular tension (defined by pressure on a dynamometer). | | as in winer, A is anxiety, B is tension, SUBJ is subject, | | and TRIAL is the repeated measurements. | | | *-----------------------------------------------------------*; data a; input subj a b t1-t4; label a='ANXIETY' b='TENSION' subj='SUBJECT'; datalines; 1 1 1 18 14 12 6 2 1 1 19 12 8 4 3 1 1 14 10 6 2 4 1 2 16 12 10 4 5 1 2 12 8 6 2 6 1 2 18 10 5 1 7 2 1 16 10 8 4 8 2 1 18 8 4 1 9 2 1 16 12 6 2 10 2 2 19 16 10 8 11 2 2 16 14 10 9 12 2 2 16 12 8 8 ; proc glm; class a b; model t1-t4 = a b a*b/nouni; repeated trials 4 polynomial/short summary; data b; set a; array trial(c) t1-t4; do c=1 to 4; response = trial; output; end; label c='experimental trial'; proc glm; class a b subj c; model response = a b a*b subj(a b) c a*c b*c a*b*c; random subj(a b); test h=a b a*b e=subj(a b); title 'completely balanced data'; data c; set b; if subj=1 then delete; proc glm; class a b subj c; model response = a b a*b subj(a b) c a*c b*c a*b*c /ss1 ss2 ss3 ss4; random subj(a b); test h=a b a*b e=subj(a b) /htype=1 etype=1; title 'AMONG SUBJECTS (WHOLE PLOT) IS UNBALANCED'; data d; set b; if _n_=1 then delete; proc glm; class a b subj c; model response = a b a*b subj(a b) c a*c b*c a*b*c /ss1 ss2 ss3 ss4; random subj(a b); test h=a b a*b e=subj(a b); title 'UNBALANCED WITHIN REPEATED MEASURES (SUBPLOT)'; run;