2

Main Question

I'm looking for help setting up a one-way repeated measures MANOVA in R for a data-set that has no between-subject factors.

Background

While there are plenty of good guides out there for setting up RM MANOVAs with between-subject factors, I have, as of yet, been unable to find any when you have an entirely within-subject design. This problem seems like it should be fairly straight-forward, but I am new to using MANOVA, so I am not sure if I'm approaching the problem correctly. I have been primarily using the car package in R, though I am open to suggestions for how to do this differently.

To demonstrate the problem, I'll use a subset of the OBrienKaiser data set, and I'll assume that each of the levels of the Hours within-subjects factor instead represents the measurement of a different dependent variable. I'll then take the pre and post conditions to be the two levels of my single within-subjects independent variable. To keep things concise, I'll only look at the first three levels from Hours.

So what I have for my data set is 16 subjects measured in two different conditions (pre and post) on 3 different dependent variables (1,2, and 3).

data <- subset(OBrienKaiser,select=c(pre.1,pre.2,pre.3,post.1,post.2,post.3))

My goal is to look for a difference between pre and post across the combination of the three different dependent variables. I've relied heavily on this guide...

http://socserv.mcmaster.ca/jfox/Books/Companion/appendix/Appendix-Multivariate-Linear-Models.pdf

... but the case used there is not quite the same, and includes between-subject conditions that I do not have. So far, I have been able to produce potentially correct results with the following approach, but my problem is that I'm not fully sure I've set the problem up correctly. In general, my approach was to follow the steps outline above, but simply omit the between-subject conditions.

My Approach

I start by designing the idata matrix for the Anova() function call by treating the condition and the dependent variables as two different within-subject factors

Condition <- factor(rep(c('Pre','Post'),each=3),levels=c('Pre','Post'))
Measure <- factor(rep(c('M1','M2','M3'),2),levels=c('M1','M2','M3'))
idata <- data.frame(Condition,Measure)

Next, build the multivariate linear model on the data-set, ignoring the between-subject factors.

mod.mlm <- lm(cbind(pre.1,pre.2,pre.3,post.1,post.2,post.3)~1,data=data)

I then call Anova() on the linear-model object mod.mlm, using the idata I defined earlier, and setting my within-subjects design to be ~Condition.

av.out <- Anova(mod.mlm,idata=idata,idesign=~Condition,type=3)

This yields the following output...

Type III Repeated Measures MANOVA Tests: Pillai test statistic
             Df test stat approx F num Df den Df   Pr(>F)    
(Intercept)  1   0.91438  160.189      1     15 2.08e-09 ***
Condition    1   0.37062    8.833      1     15 0.009498 ** 
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

To me this process and this result seems reasonable. There are two things that give me pause.

  1. When setting up the linear model, the lack of a predictor variable seems odd, but I think it ends up being defined in the call to Anova() with idesign. If that is just how one sets up the Anova with car then, great. It just seems odd to construct a linear model with out a predictor when I have a predictor variable I'm explicitly interested in.

  2. If I use summary(an.out) to take a more in-depth look at the model that comes out, I can see the contrasts that go into the design. The contrast that is produced with the above approach codes pre with 1 and post with -1. I believe that this is the appropriate contrast for what I am trying to do, but I am not completely sure. Given that one can pass in a custom contrast using imatrix or contrasts in the call to Anova(), I'd like to be sure that what I am trying to test (i.e., differences between pre and post across the three dependent variables) is what I'm actually testing.

Any help and/or advice on how to understanding repeated measures MANOVA in general in this context would be greatly appreciated, as well as specific advice on how to implement this in R.

Bonus

I would also like to do the same thing in Matlab, so if anyone has specific advice on that it would be appreciated (though I realize this might require its own question).

TheRobotPants
  • 21
  • 1
  • 2
  • Welcome to SO. I'd suggest http://stats.stackexchange.com for statistical questions. – lukeA Nov 22 '15 at 12:40
  • Thanks for the suggestion @lukeA. I posted the question to stats.stackexchange.com. It seems like it rides the line between statistics and programming, but I definitely want to get it to the right community. – TheRobotPants Nov 24 '15 at 23:06

0 Answers0