How can I do repeated measures ANOVA with covariates in SPSS?

How can I do repeated measures ANOVA with covariates in SPSS?

Repeated measures ANOVA with covariates is a statistical analysis method used to determine the effects of one or more independent variables on a dependent variable that is measured multiple times. In SPSS, this can be done by selecting the “Mixed Models” option under the “General Linear Model” menu. This allows for the inclusion of covariates, which are additional variables that may influence the relationship between the independent and dependent variables. The results of this analysis can provide valuable insights into the effects of the independent variables, while also controlling for the influence of the covariates.

How can I do repeated measures ANOVA with covariates in SPSS? | SPSS FAQ

SPSS provides several ways to analyze repeated measures ANOVA that include covariates.
This FAQ page will
look at ways of analyzing data in either wide form, i.e., all of the repeated measures for a subject
are in one row of the data, or in long form where each of the repeated values are found on a
separate row of the
data.

There are two kinds of covariates found in repeated measures analyses; 1) time-invariant covariates
or 2) time-varying covariates.
With time-invariant covariates there is just one value that is used for all the repeated observations
for a given subject. Time-varying covariates, on the other hand, can take on a different value
for each of the repeated observations.
Time-invariant covariates can be analyzed with either wide data or long data. However,
time-varying covariates require the data to be in the long form.

Here is an example of what one subject’s data with a time-varying covariate looks like in wide form.

sub group dv1 dv2 dv3 cv1 cv2 cv3
 1    1    3   4   7   3   1   2

And here is what the same data for the same subject looks like in long form.

sub group trial  dv   cv
 1    1     1     3    3 
 1    1     2     4    1
 1    1     3     7    2

Now we can begin by reading in the example data in wide form.

data list list
  / sub group dv1 dv2 dv3 cv1 cv2 cv3.
begin data.
1 1  3  4  7  3 1 2
2 1  6  8 12  9 3 1
3 1  7 13 11 11 8 4
4 1  0  3  6  6 2 1
5 2  5  6 11  7 8 3
6 2 10 12 18 15 9 5
7 2 10 15 15 14 8 6
8 2  5  7 11  9 2 8 
end data.

Model 1

We will begin by using the glm procedure keeping the data in the wide form. We will use cv1
as the time-invariant covariate. When the data are wide you cannot use a time-varying covariate. To include
the covariate in the model we use the with term in the first line of the command. For the
purposes of this FAQ page, we will
display only the univariate ANOVA tables for within-subjects and between subjects effects.

glm dv1 dv2 dv3 by group with cv1
  /wsfactors=trial 3
  /wsdesign=trial
  /design=group cv1.
Tests of Within-Subjects Effects
Measure:MEASURE_1
SourceType III Sum of SquaresdfMean SquareFSig.
trialSphericity Assumed16.32528.1634.439.042
Greenhouse-Geisser16.3251.08115.0984.439.084
Huynh-Feldt16.3251.6979.6204.439.052
Lower-bound16.3251.00016.3254.439.089
trial * groupSphericity Assumed6.56523.2821.785.217
Greenhouse-Geisser6.5651.0816.0711.785.238
Huynh-Feldt6.5651.6973.8681.785.225
Lower-bound6.5651.0006.5651.785.239
trial * cv1Sphericity Assumed6.44523.2231.753.223
Greenhouse-Geisser6.4451.0815.9611.753.242
Huynh-Feldt6.4451.6973.7981.753.230
Lower-bound6.4451.0006.4451.753.243
Error(trial)Sphericity Assumed18.388101.839  
Greenhouse-Geisser18.3885.4063.401  
Huynh-Feldt18.3888.4852.167  
Lower-bound18.3885.0003.678  

Tests of Between-Subjects Effects
Measure:MEASURE_1
Transformed Variable:Average
SourceType III Sum of SquaresdfMean SquareFSig.
Intercept1.46611.466.217.661
group.6351.635.094.771
cv1173.1411173.14125.631.004
Error33.77556.755  

Note that the output above includes the trial*cv1 interaction as part of the within-subjects
effects. If this is what you want, fine. But if you don’t want this interaction term you will
need to run the model with a different procedure, the manova command.

Model 2

The manova command can only be run from
syntax, it cannot be run using the pull-down menus. The manova command is much older than
glm and its syntax is a bit fussier. For example, you have to declare the range of levels
for each of the by factors and the covariate needs to be placed inside parentheses.
Again, we will focus on the univariate between- and within-subject effects.

manova dv1 dv2 dv3 by group(1,2) with (cv1)
  /wsfactors trial (3)
  /wsdesign trial
  /design.


* * * * * * * * * * * * * * * * * A n a l y s i s   o f   V a r i a n c e -- Design   1 * * * * * * * * * * * * * * * * *

Tests of Between-Subjects Effects.

 Tests of Significance for T1 using UNIQUE sums of squares
 Source of Variation          SS      DF        MS         F  Sig of F

 WITHIN+RESIDUAL           33.78       5      6.76
 REGRESSION               173.14       1    173.14     25.63      .004
 group                       .64       1       .64       .09      .771

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Regression analysis for WITHIN+RESIDUAL error term
 --- Individual Univariate .9500 confidence intervals
 Dependent variable .. T1

 COVARIATE               B           Beta      Std. Err.        t-Value      Sig. of t     Lower -95%     CL- Upper

 Tcv1          .8415132924    .9098200606         .16622        5.06274           .004         .41424        1.26879

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

* * * * * * * * * * * * * * * * * A n a l y s i s   o f   V a r i a n c e -- Design   1 * * * * * * * * * * * * * * * * *

Tests involving 'TRIAL' Within-Subject Effect.


 Mauchly sphericity test, W =      .36971
 Chi-square approx. =             4.97514 with 2 D. F.
 Significance =                      .083

 Greenhouse-Geisser Epsilon =      .61339
 Huynh-Feldt Epsilon =             .81855
 Lower-bound Epsilon =             .50000

AVERAGED Tests of Significance that follow multivariate tests are equivalent to
univariate or split-plot or mixed-model approach to repeated measures.
Epsilons may be used to adjust d.f. for the AVERAGED results.

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

* * * * * * * * * * * * * * * * * A n a l y s i s   o f   V a r i a n c e -- Design   1 * * * * * * * * * * * * * * * * *

Tests involving 'TRIAL' Within-Subject Effect.

 AVERAGED Tests of Significance for dv using UNIQUE sums of squares
 Source of Variation          SS      DF        MS         F  Sig of F

 WITHIN+RESIDUAL           24.83      12      2.07
 TRIAL                    126.58       2     63.29     30.58      .000
 group BY TRIAL             3.25       2      1.63       .79      .478

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

The t-test for for cv1 is 5.06274 and is found on the row beginning with Tcv1.

Model 3

We used glm and manova with data in the wide form. It is also possible to analyze
these two models with data in the long form using the mixed command. In fact, if you want
to include time-varying covariates you will need to use mixed. The varstocases command
below will handle the data conversion from wide to long but before we run the command we will
create a new variable, cvone, that we will use in the models with a time-invariant covariate.

compute cvone=cv1.

varstocases
 /make dv from dv1 dv2 dv3
 /make cv from cv1 cv2 cv3
 /index = trial.

For Model 3, we will use the mixed command to duplicate the analysis from Model 1. The
first line of the command looks very much like the glm command. The fixed
subcommand lists all of the fixed effects including the trial*cvone interaction. The
repeated line declares the name of the repeated effect while the subject() option is used
for the subject identifier. To reproduce the glm output we also include the
covtype(cs) option which select the compound symmetry covariance structure.

mixed dv by group trial with cvone
  /fixed= group trial group*trial cvone trial*cvone
  /repeated= trial | subject(sub) covtype(cs).
 
Type III Tests of Fixed Effectsa
SourceNumerator dfDenominator dfFSig.
Intercept15.217.661
group15.094.771
trial210.0004.439.042
group * trial210.0001.785.217
cvone1525.631.004
trial * cvone210.0001.753.223
a. Dependent Variable: dv.

Model 4

Next, to reproduce the results from Model 2, the manova command with wide data, we will run
the same model as Model 3 but drop the trial*cvone interaction term. The F-ration for
cvone of 25.631 is the same as the t-value squared for cv1 from Model 2, i.e.,
5.06274^2 = 25.631336.

mixed dv by group trial with cvone
  /fixed= group trial group*trial cvone
  /repeated= trial | subject(sub) covtype(cs).
 
Type III Tests of Fixed Effectsa
SourceNumerator dfDenominator dfFSig.
Intercept15.217.661
group15.094.771
trial212.00030.584.000
group * trial212.000.785.478
cvone1525.631.004

Model 5

Our final example shows how to analyze the repeated measures ANOVA with a time-varying covariate.
The covariate cv has a different value for each of the repeated trials.

mixed dv by group trial with cv
  /fixed= group trial group*trial cv
  /repeated= trial | subject(sub) covtype(cs).
 
Type III Tests of Fixed Effectsa
SourceNumerator dfDenominator dfFSig.
Intercept112.80127.746.000
group15.8812.177.191
trial210.85812.708.001
group * trial210.287.704.517
cv112.235.081.780

The results from Models 1 and 3 are identical as are the results from Models 2 and 4. However, the
results for Models 1 and 3 cannot be directly compared with the results from Models 2 and 4, Nor,
can either of those be compared with Model 5. The models differ in the number of predictors and
the type of covariate and so are not comparable.

Cite this article

stats writer (2024). How can I do repeated measures ANOVA with covariates in SPSS?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-do-repeated-measures-anova-with-covariates-in-spss/

stats writer. "How can I do repeated measures ANOVA with covariates in SPSS?." PSYCHOLOGICAL SCALES, 30 Jun. 2024, https://scales.arabpsychology.com/stats/how-can-i-do-repeated-measures-anova-with-covariates-in-spss/.

stats writer. "How can I do repeated measures ANOVA with covariates in SPSS?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-do-repeated-measures-anova-with-covariates-in-spss/.

stats writer (2024) 'How can I do repeated measures ANOVA with covariates in SPSS?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-do-repeated-measures-anova-with-covariates-in-spss/.

[1] stats writer, "How can I do repeated measures ANOVA with covariates in SPSS?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.

stats writer. How can I do repeated measures ANOVA with covariates in SPSS?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.

Download Post (.PDF)
Slide Up
x
PDF
Scroll to Top