Implementing non-parametric version of 2x2 Repeated Measures ANOVA in R


New Member
Hi, I have a 2x2 repeated measures design (i.e. 1 group of participants provide data for all 4 conditions in a fully factorial counterbalanced design [so there is no time factor to worry about]). The data is non-normal so I need to use a non-parametric equivalent of the 2x2 factorial ANOVA.

I've done some reading and it appears that there are a batch of different 'robust' methods, involving winsorized means/bootstrapping/rank-procedures that can apparently be used for such purposes. This seems fine but my problem is how to implement these methods.

I usually use SPSS for data analysis, but it does not provide a way of implementing these methods. From what I've read the R software appears to be the way to go. At my institution we have version 2.1.2. However I can't find a clear description of what code I should run to implement this analysis. I've got a copy of Wilcox 'Robust Estimation and Hypothesis Testing' but it's a bit over my head, and also appears to only talk about one-way repeated measures and then mixed designs, but misses out 2-way designs that are purely repeated measures. This is a problem I have found with a lot of the texts available for R, presumably because they are written with medical research in mind, where there is generally at least 1 between-subjects factor (i.e. treatment group vs control group).

Can anyone give me some straightforward advice as to how I can run a non-parametric 2x2 repeated measures analysis in R? Bear in mind that I have no real experience of R.

Hi, I would like to revive this thread as I have the very same question.
That is, does anyone know how to run a non-parametric 2x2 repeated measures analysis in R?
Thanks, Vera


Alright let's back the trolley up a minute so we can understand what the problem is (to quote one of my favorite scientists):

Einstien was asked what he would do if he had one hour to save the world he responded that he would spend fifty-five minutes defining the problem and only five minutes finding the solution.
Let's define the problem before we make a type 4 error: solving the wrong problem precisely :)

  1. What is your hypothesis(s)?
  2. What is your DV(s) and type [ie. categorical (inlcude groups) or numeric (discrete, continuous, etc.)]?
  3. What is your IV(s) and type [ie. categorical (inlcude groups) or numeric (discrete, continuous, etc.)]?

Once we have this information we can give better insight about how to approach it.
Hi trinker,

I like the quote ;). Alright.

So I have a 2x2 within-subject design. Hence, each subject participated in four different conditions (2 factors with 2 levels).

My outcome variable is continuous, but not normally distribued (some conditions very skewed).

My hypothesis is that there will be an interaction between the two within-subject factors.

So far I have not been able to normalise the data using transformations (log, squareroot, etc). Therefore I would like to use a non-parametric analysis to test the interaction of the two factors.



Why are you trying to normalize the data? What has told you that your data has to be normally distributed? The answer to this will depend on the advice given about parametric vs. nonparametric.
I was trying to normalise the data in order to be able to use a normal parametric Repeated-Measures-ANOVA. Then it would be very easy to calculate an interaction between the two factors. In Friedman's ANOVA (the non-parametric equivalent to Repeated-Measures-ANOVA) I don't think I can specify factors (?!) and therefore I can only test for an overall effect but not the interaction between the factors.

>What has told you that your data has to be normally distributed?

I actually have the problem for two different dependent variables which I want to analyse separately (I did not say that above for simplicity.)

DV 1: It is numeric and continuous. Non-normality is only present in one of the four conditions as indicated by a significant Shapiro-Wilk test. The non-normality is due to ONE outlier participant who gave an unusually high response in this condition and this renders the distribution non-normal. Excluding this subject or the outlier-data-point seems wrong, as this would be in line with our hypothesis and would hence change the data in favor of our hypothesis.

DV 2: This second outcome variable is numeric and DISCRETE (ratings on a Likert-skale: from 1 to 7). Both Shapiro-Wilk and Kolmogorv-Smirnoff test are highly significant for this variable, indicating non-normality. That is because the scores are clustered at the low scores-end (1-2) rather than normally distributed across the whole range. Hence in the histograms I have a peak on the left side and then a long tail on the right.
Oh sorry - you asked "What has told you that your data HAS TO BE normally distributed?" rather than "What has told you that your data was normally distributed?"

Well, I think the data have to be normally distributed if I want to run a normal parametric repeated-measures ANOVA on it, right? Since this is one assumption of the ANOVA.


Linear models do not assume normality of the data but normality of the error terms (the residuals). You can run the repeated measures model (parametric) and determine normality of the residuals through a qqplot. This can be done by wrapping the model object with a call to plot as in: plot(mod1). If you see a departure from normality in the error terms then we'll worry about a non parametric test.

NOTE: The car package also has some nice diagnostic features for testing model assumptions (see the book R in Action, Robert Kabacoff, for a nice guide to using car for checking model assumptions)
Oh really, just the residuals? I didnt know that. I have heard/read pretty often that the data themselves have to be normally distributed. Is that really wrong? Or does that only hold in some cases and in other cases you just need normality of the residuals?

Well, thank you for your answers so ! I will look into this further with the car package probably tomorrow, and then answer again.
Please find some answers to your question in the following papers:

Akritas, M. G., Arnold, S. F. and Brunner, E. (1997). Nonparametric hypotheses and rank statistics for unbalanced factorial designs. Journal of the American Statistical Association 92, 258-265.
Brunner, E. and Puri, M.L. (2001). Nonparametric Methods in Factorial Designs. Statistical Papers 42, 1-52.
Konietschke, F., Placzek, M. Schaarschmidt, F., and Hothorn, L.A. (2015). Nparcomp: An R Software Package for Nonparametric Multiple Comparisons and Simultaneous Confidence Intervals. Journal of Statistical Software 64, Iss. 9.
Shah, D.A. and Madden, L.V. (2004). Nonparametric Analysis of Ordinal Data in Designed Factorial Experiments. Phytopathology 94, 33-43. Electronic Appendix: Instructions on the Use of Software and Applications (e-extra).

Some software is also available from (thispart of the homepage is only available in German)

Kind regards,
Edgar Brunner