I need advice about a two-way repeated measures ANOVA


I would appreciate some advice about how to analyze my data.

These data come from an experiment during which the hearing of 18 ears was measured over time and according to different frequencies.

Each ear was measured at T1, T21, and T 28, and at each of its times, each ear was measured at frequencies 4000Hz, 8000Hz, 16000Hz, 25000Hz, and 32000Hz.

I especially want to know if there is a time effect. The frequency effect does not particularly interest me.

I was thinking of using a 2-factor anova for repeated data (with 2 factors within: time and frequency).

I work under R and I thought to use the lmer function with this code:

mod.lmer ← lmer(hearing ~ Point * Hz Frequency +(1|id/Point) +(1|id/Hz Frequency),
contrasts=list(Point=contr.sum, Frequency Hz=contr.sum),

id is the ear identification factor

I’m not sure about the coding of random effects (1|id/Point) +(1|id/Frequency Hz), but they give me the same results as the aov.ez function in the afex package :

mod.ez ← aov_ez(id=“id”,
dv=“Threshold dB”,
within = c(“Point”, “Frequency Hz”))

What do you think ?

Does this analysis seem correct to you? If not, what can you suggest me?

Thanks in advance for any help you can give me.

All the best


I am far from being an expert; I am just a beginner but it happened that I read about RM recently, ggwithinstats function may help as shown in this tutorial: RPubs - 2-way Repeated Measure ANOVA

I think Mixed models can be of value too

All the best in your study…

1 Like

Hi Abdurrahman,

Thanks a lot for the link, I appreciate a lot !
Best wishes


Since you are using R, let me point out a couple of R specific resources:

The primary R e-mail list for mixed effects and related models - R-SIG-Mixed-Models

The above list is focused on this domain, and the people that develop and support the lme4 package are there, and so available to give you expert opinions.

There is also a focused FAQ here:


which has some great content, including information on decisions around model specification, such as fixed versus random effects, as well as nested and crossed effects.

I would recommend reviewing the FAQ and consider posting your specific query and hypotheses to the e-mail list, after subscribing to it.

1 Like


Ok, thanks for the link, I will post my question.
All the best