# Repeated measures ANOVA with time series

I have data from 7 sites, which are under 3 types of AMD impairment (2 impaired, 3 recovered, 2 unimpaired); each site has 3 different treatments (Undisturbed Upstream, Disturbed, Undisturbed Downstream). Sites were sampled right before the treatment (day 0), and then 5, 10, 15, and 30 days after treatment.

I want to see if there are any significant differences in macro measurements (abundance, richness, feeding groups, etc.) over time across the AMD impairment types and the treatments.

My first thought is a repeated-measures ANOVA like:

Macro_abund ~ AMD_Impairment*Treatment*Day + Error(Site/Impairment*Section)

Using function aov in R, I get an error that the model is singular.

I'm beginning to wonder if repeated measures ANOVA is an inappropriate analysis, but I'm not sure what a better alternative would be.

• You haven't given anyone enough detail to connect your substantive description of your problem to the code you tried and failed with. A minimal example of data and code would help. But you haven't mentioned Section in the description, so maybe that is the problem. – user101089 Feb 22 '17 at 2:23
• At this point, the answer is that you are doing something wrong. – Carl Feb 22 '17 at 4:51
• Why not fit a smaller model first then gradually build up to what you think you need? – mdewey Feb 22 '17 at 14:01

## 1 Answer

Usually that error means you do not have a independent variable for each dependent variable. Ex: you are missing data somewhere. You can either fill in these missing values, or drop those rows.

If the idea of dropping an observation/row entirely rubs you the wrong way, according to another forum you could look into conducting the analysis as a linear mixed model. I too am having issues determining what goes in the line of code where you have "site."

Macro_abund ~ AMD_Impairment*Treatment*Day + Error(Site/Impairment*Section)

Where you have "site" I have an ID number for each observation per treatment (CODE) per SITE (each row = 1 observation).

My code: x1.aov<-aov(X1 ~ MONTH * SITE * CODE + Error(ID/(SITE * CODE)), data=HNME1)

Someone else also recommended changing your "SITE" or in my case- "ID" to a factor. HNME1$ID <- factor(HNME1$ID) Hope this helps a little bit!