# Questions about conducting Mixed-Design ANOVA in R

I have a dataset that includes one IV with 3 levels (group 1, group 2, and group 3) and a repeated DV (pre test score and post test score). I am using R, but I'm unsure what codes I should use to test for the mean differences. In my dataset, each row represents a subject and so they are grouped by including a numerical value to each group 1 = First Group, 2 = Second Group, and 3 = Third Group.

I need to compare the mean decrease/changes over the 2 time periods(pre & post) across the groups to assess if there is a significant change in any of the groups. I think that ANOVA mixed-design/two-way repeated measures anova/split-plot anova is the right statistical technique. Can anyone help with the right code/package for this research-design? Also, how can I plot the outputs?

• With this design, I would assume that the hypotheses of interest are whether the pre-post change differs between groups, not simply whether each group experiences significant change. I recommend editing your question if that is the case. – dbwilson Jan 3 '19 at 14:56
• In terms of analyzing this in R, you will need to restructure your data from wide (its current structure) to long. There is a lot of information on the internet about reshaping data and there are several ways of doing this in R. The result will be four variables, subject ID, group (values 1, 2, 3), time (pre/post), and the value of the DV. Thus, you will have two rows for each subject. You could then estimate the model as: aov(dv ~ group*time + Error(id), data=df), replacing the terms with the appropriate names. You are interested in the F for the interaction. – dbwilson Jan 3 '19 at 15:02
• After reading this you can answer your own question. – kjetil b halvorsen Jan 4 '19 at 20:09
• Thank you all, dbwilson and kjetil b halvorsen. After reading the dbwilson instructions, I was able to conduct the analyses using the following formula: anova(lmer(DV~ Year*TestType + (1 | PID), data=LongDataDeg)) Thanks again, dbwilson . – user232874 Jan 9 '19 at 21:42