Title '3 Factor Design with 1 Repeated Measure'; *-----------------------------------------------------------* | 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 repm1; input subj A B t1-t4; label A='Manifest Anxiety' B='Muscle Tension' subj='Subject'; cards; 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 printH printE summary; Title2 'Multivariate REPEATED Measure Analysis'; run; *-----------------------------------------------------------* | Reshape the data for mixed model analysis | *-----------------------------------------------------------; data repm2; set repm1; ARRAY score(trial) T1-T4; do trial=1 to 4; response = score; output; end; *-----------------------------------------------------------* | Mixed model analysis: | | Subjects are a random factor, nested within A & B (fixed) | | The error term for between-S effects MUST be specified on | | the TEST statement. | | The error term for within-S effects and the interactions | | with factor C is the residual. | *-----------------------------------------------------------; proc glm; class A B subj trial; model RESPONSE = A B A*B subj(A B) /* between */ trial A*trial B*trial A*B*trial /* within */ / SS3; /* Type I = Type III */ contrast 'T-linear' trial -3 -1 1 3; contrast 'T-quad ' trial 1 -1 -1 1; contrast 'T-cubic ' trial -1 3 -3 1; RANDOM subj(A B); /* declare SUBJ random -> EMS */ test H=A B A*B E=subj(A B); title2 'Mixed Model Analysis'; run; *-- Plot the between-S means; proc summary data=repm2 nway; class A B; var response; output out=means mean=response; title2 'A * B means'; proc plot; plot response * A = B; run;