# Repeated measure ANOVA with an interaction

I am conducting a one way repeated measure ANOVA where my dependent variable is measured at 3-time points, at baseline, 1 month, and at 2 months. I also have another variable measured at baseline. My primary goal is to see if there is a significant difference in the dependent variable between baseline-1month, baseline-2months, and 1month-2months. However, the literature shows that the other variable measured at baseline can influence the magnitude of dependent variable over time, as well as can make it insignificant. I don't know if controlling for is the right word, but I would like to see the interaction effect of this other variable in the 3 pairs of comparison. Any suggestion is highly appreciated! Thank you.

• Your objective is not clear. Please restructure your question and I think you are looking for Anova solution. Give a few more details about datatypeand samples size etc. Nov 16 '17 at 2:49

## 2 Answers

You could treat this as a mixed-effects (a.k.a., multilevel or hierarchical) model. The first "level" is measurement occasion, while the second is the individual. The independent variable at the first "level" is the time point, and the baseline moderator is at the second "level." The dependent variable is also at the first "level."

Let $Y$ be the dependent variable, $X$ be the time point, and $Z$ be the baseline moderator; $i$ denotes a measurement occasion, and $j$ denotes an individual.

Your model would be:

Level 1:

$Y = \beta_{0j} + \beta_{1j}X_{ij} + \epsilon_{ij}$

This means that your dependent variable is predicted by an intercept, the time point, and a residual. The subscript $j$ for $\beta_0$ and $\beta_1$ means that the intercept and effect of time will be different for every person. These will, in turn, be predicted by the baseline score for every person:

Level 2:

$\beta_{0j} = \gamma_{00} + \gamma_{01}Z_j + u_{0j}$

$\beta_{1j} = \gamma_{10} + \gamma_{11}Z_j + u_{1j}$

Where $\gamma_{00}$ is the average intercept, $\gamma_{10}$ is the average effect of time, $\gamma_{01}$ is the effect of the baseline moderator on the individual's intercept (this turns into the main effect of the baseline moderator), and $\gamma_{11}$ is the effect of baseline moderator on the individual's effect of time (this turns into the cross-level interaction that you're interested in).

The easiest way to run this, in my opinion, would be using the lme4 package for R. This would look something like:

your_model <- lmer(dv ~ iv * baseline_moderator + (1 + iv | id), data)

where dv would be your dependent variable, iv would be the independent variable, baseline_moderator would be the baseline moderator, id would be the identification code (as a factor vector) for each of your participants, and data would be the name of the data frame.

More information on the lme4 package can be found here: http://rpsychologist.com/r-guide-longitudinal-lme-lmer

you have 2 indep. variables: 1- variable which is between subj. factor 2- within subject variable (time)

and you evaluating these factors on the third (dependent) variable. so you need to perform a mixed design test.

good luck