My proposition of the solution

Perform Box-Cox-transformation despite of knowledge that obeservations are nont independent and then use rANOVA to estiamte coefficients using the knowledge that the observations come from repeated measures design

What is ANOVA?

One might treat basic one-way (with one discrete explanatory variable) Analysis of Varianace (ANOVA) model as a special case of a linear model with one discrete explanatory variable.

ANOVA estimates the difference of the mean of response variable between the levels of explanatory variable, and returns the F-statistics (based on variances, hence the name) from which one might infer the statistical significance of estimated differences (that are treated as coefficients in linear model, for suitable variable coding).

Why do we use Box-Cox transformation?

Due to the form of F-statistic, the assumption of independence, normality and homogeneity of the variances of the residuals is required. Those assumptions are often not satisfied, and one might perform Box-Cox transformation, using the full model, to transform the response variable to have more normal-like distribution.

Problem: Repeated Measures

Sometimes one might hit on a study that is design for repeated measures, and then the special Error stratum is required to take into account the blocked nature of a model. Hence, the repeated measure ANOVA can be performed (rANOVA), but as usual one can encounter non-normal distribution situation.

Dealing with repeated measures looks like to be a solved mathematical problem, moreover statistics is equiped in Box-Cox transformation when normality assumption is not fulfilled so one also has a tool to deal with non-normality. But what if a design is blocked, we encounter a repeated measures type of observations and response variable does not come from normal distribution.


Then one should perform Box-Cox tranformation for the repeated measures Analysis of Variance (rANOVA), but it does not seem to be implemented in R statistical package.

I've tried myself to have a look at the implementation of MASS::boxcox function (https://github.com/cran/MASS/blob/master/R/boxcox.R), but there only appear a method for standard aov (analysis of variance) that is treaten as a linear model (lm class). For repeated measures ANOVA (class aovlist) R below example does not work

> npk.aov <- aov(yield ~  N*P*K, npk)
> boxcox(npk.aov)
> npk.aovE <- aov(yield ~  N + Error(block), npk)
> boxcox(npk.aovE)
Error in boxcox.default(npk.aovE) : 
  ‘npk.aovE’ does not have both 'qr' and 'y' components
> boxcox(npk.aovE[[3]])
Error in update.default(object, y = TRUE, qr = TRUE, ...) : 
  need an object with call component
> npk.aovE[[3]]$y <- npk$yield
> boxcox(npk.aovE[[3]])
Error in qr.resid(xqr, yt) : 
  'qr' and 'y' must have the same number of rows

beacuse of the QR decomposition matrix has only 18 rows

> nrow(npk.aovE[[3]]$qr$qr)
[1] 18
> NROW(npk.aovE[[3]]$y)
[1] 24

Does anyone know how to implement such alghoritm or have seen any package containing Box-Cox tranformation for repreatead measures ANOVA ?? I have seen Friedman's approach, which is an equivalent for Kruskal-Wallis test (non-parametric ANOVA) for repeated measures type of observations, and even the post-hoc tests implemented by Tal Galili (http://www.r-statistics.com/2010/02/post-hoc-analysis-for-friedmans-test-r-code/) but this approach is not sufficient for me since I will not obtain the linear model coefficients with a rank test, which Friedman's test is - I am most intersted in knowing what's the difference between groups in the explanatory variable. Maybe one could propose a differet approach than Box-Cox transformation for repreated measures ANOVA (rANOVA) ?


1 Answer 1


As @kjetil b halvorsen suggests I would go with linear mixed models: here are relevant paper and post .


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.