# How to use a 2 way ANOVA in R if pre/post is one of the factors.

I am trying to run a 2-way Anova that has 2 independent factors. The experimental/control group which is easy enough and then the other factor is condition (pre-post). Basically, there were two groups of stroke patients and their movement capacity was evaluated using a test. The experiment wanted to see if traditional therapy or some new therapy is more effective and split the 2 groups up by treatment method. That is one of the factors and they state that "condition (pre-post)" was the other independent variable. They then evaluated all of the patients after treatment with the same test and took note of their net increase in score. I understand 2 Way Anovas for the most part but I am having a hard time quantifying the pre-post data to be used for a 2 way ANOVA.

## 3 Answers

1. Please read Senn article on pre-post and why these designs should be analyzed with ANCOVA model

y ~ treatment + condition

1. The answer to your question (if you wanted to use 2-way) is to use the interaction effect as the "difference in the change" in the response. But again, see any Senn article on pre-post

https://doi.org/10.1002/sim.2682

Considering the seriousness of the subject matter, I would advise you to consult with a statistician or knowledgeable person who can look at the actual study design and data and advise you as to the best approach. This isn't me, but others on this site may meet that qualification.

That being said, from your description --- "That is one of the factors and they state that "condition (pre-post)" was the other independent variable." ---, it sounds like you are describing an analysis of covariance (ancova), where, yes, the value for movement in the pre- period is entered into the model as an independent covariate, and treated as a continuous variable (and not as a factor variable as if you were doing a two-way anova). So your model is something like, Movement_post ~ Movement_pre + Group + Movement_pre:Group. With this approach, you can plot Movement_post vs. Movement_pre for each Group, and interpret the results as to the difference in intercept and slope of these lines.

A different approach is that mentioned by @yc_hello , which is to use the difference for each subject as the dependent variable and then use a one-way t-test or anova. This approach also allows you to easily use a different metric, like percent change, as the dependent variable.

Another approach, a mixed-effects model, with Subject as a random term might be appropriate. Something like, Movement ~ Group + Time + (1|Subject). It's not as scary as it sounds, and opens up better ways to analyze some designs. Here you might plot the mean or e.m. mean Movement vs. Time, with Group_1 one color and Group_2 another color. This is easy to interpret, and allows you to show that the two groups were similar in movement in the pre- period.

It seems to me a one-way anova/independent t-test since the response is the "net increase" (i.e., difference between pre and post).

If you really want to analyze it as a 2-way ANOVA, then you will need to model the dependence of pre and post.

Using gls for an example.

    gls(movement~trt*time, correlation=corCompSymm(form=~1|subject),data=...)


You can model other correlations such as corAR1 and corSymm. Using corCompSymm is equivalent to treating subject as a random factor as Sal suggested (induced correlation in random effect).

You can address heterogeneity by using weights=...