I am currently comparing the EEG funcional connectivity measured at 14 electrodes and 4 frequency bands between highly and lowly hypnotic susceptible individuals. I extracted the coherence and the absolute imaginary coherency for all 91 possible connections. As a design for statistical analysis, I chose a two way repeated measures anova. With the within subject variable Condition(no hypnosis, hypnosis) and the between subject variables Group(highly susceptible (7), lowly susceptible (9)) and Connection(different connections between the electrodes(91)).

Unfortunately I am far from meeting the requirements for normality and equality of error variances. Even with ln(x+1), log(x+1), sqrt(x), 1/x transformation.

Does anyone have an idea, which design of non-parametric tests would fit here?

In the foto you can see the structure of my data set for one frequency band.

Any help would be greatly appreciated.

Many thanks.


I'm not sure I have your exact ANOVA model clearly in mind. But it seems sufficiently complex that I doubt there is any specific nonparametric procedure that matches it. (For a one-way ANOVA, the Kruskal-Wallis test is a good match, for a simple block design there is the Friedman test. But there are not many specialized nonparametric tests for more complex designs. Maybe others on this site will want to comment on possibilities.)

One general procedure might work in your case. That is to do a standard ANOVA matching your model, but use ranks of the combined data instead of the nonnormal numerical values. I will illustrate how this works for a one-way ANOVA with three levels of the factor.

Suppose we have exponential data as simulated below:

x1 = rexp(20, .05);  x2 = rexp(20, .10);  x3 = rexp(20, .20)
x = c(x1, x2, x3;  g = as.factor(rep(1:3, each=20))

Standard ANOVA on the original data. In spite of the non-normality and difference in variances in the three levels, this test shows a P-value < 5%.

Without further investigation, I would trust this P-value only to give a rough indication of differences among levels, but because the assumptions for this procedure are grossly violated I would not expect the P-value to be exact. (The difficulty is not with the F-statistic itself, which is a reasonable way to measure differences among levels; it is that the F-statistic might not have an F-distribution because of the failure of assumptions.)

anova(lm(x ~ g))
Analysis of Variance Table

Response: x
          Df Sum Sq Mean Sq F value  Pr(>F)  
g          2  929.9  464.95  4.8229 0.01161 *
Residuals 57 5495.1   96.40                  
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Standard ANOVA on ranks. Ranks of the 60 observations will run consecutively from 1 through 60. Of course, ranks are not normal, but severe heteroscadisticy and outliers are 'tamed' by the ranking procedure, so the violations of standard ANOVA assumptions are not so serious.

anova(lm(rank(x) ~ g))

Analysis of Variance Table

Response: rank(x)
          Df  Sum Sq Mean Sq F value   Pr(>F)   
g          2  3220.9 1610.45  6.2133 0.003622 **
Residuals 57 14774.1  259.19                    
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Here are boxplots of original data and ranks of data.

enter image description here

In effect, the results are not a lot different from those of the Kruskal-Wallis nonparametric one-way ANOVA, shown below. (An argument against using the K-W test here is that distributions change in shape as well as location from one level to the next. Nonparametric tests do not require normal data, but they are not without assumptions.)

kruskal.test(x ~ g)

        Kruskal-Wallis rank sum test

data:  x by g
Kruskal-Wallis chi-squared = 10.56, df = 2, p-value = 0.005092

Notes: For the simple one way design of the artificial data above, there are several other possible procedures, which I do not see how to generalize to more complicated designs. Examples are (a) and (b) below.

(a) The procedure oneway.test in R does a Welch-style one-way ANOVA that does not assume equal variances in the three groups. The P-value for the data above is about 0.009.

oneway.test(x ~ g)$p.val
[1] 0.008868364

(b) Take logarithms of the data to stabilize variances and mitigate outliers: P-value about 0.002.

anova(lm(log(x) ~ g))[1,5]
[1] 0.001927942

(c) Permutation test. It would not be difficult to do a permutation test on the original data, using the F-statistic as the 'metric'. The F-statistics of many ANOVAs with the g-vector randomly scrambled are compared with the observed F-statistic for the original data to get the approximate P-value 0.01028 of the permutation test. (This P-value is not hugely different from the P-value about 0.01161 of the standard one-way ANOVA, suggesting that 0.01161 was not seriously incorrect.)

f.obs = anova(lm(x ~g))[1,4]; f.obs
[1] 4.822906
f.prm = replicate(10^5, anova(lm(x~sample(g)))[1,4])
mean(f.prm > f.obs)
[1] 0.01028

In principle, you could do a permutation test to analyze data from your design, but depending on the complexity of that design, the choice of metric and the programming details would need to be considered carefully.

  • $\begingroup$ Unlike, Friedman's test, the Kruskal-Wallis test is inappropriate for a repeated measures design. $\endgroup$ – Alexis Nov 22 '19 at 4:18
  • $\begingroup$ Didn't suggest it for repeated measures designs. $\endgroup$ – BruceET Nov 22 '19 at 4:39
  • $\begingroup$ That's not clear given the OP's question title. Also: Kruskal-Wallis does not assume equal variances, or equivalently shaped distributions: it is more general, just like the rank sum test. The additional distributional assumptions only enter in if you want to interpret it's Ha as (omnibus) evidence for location shift, but without those additional assumptions it is still an omnibus test for (0-order) stochastic dominance. $\endgroup$ – Alexis Nov 22 '19 at 5:33
  • 1
    $\begingroup$ I find your lectures on K-W tests not to be helpful. Back around 1961 I learned about K-W tests from Kruskal. I think we have been through something like this before. You have a right to your point of view, of course. For the possible benefit of others, feel free to explain what you mean. Better yet, if you want to give what you believe to be a better answer, please post it. $\endgroup$ – BruceET Nov 22 '19 at 6:11
  • 1
    $\begingroup$ That's fair, but the first paragraph of Kruskal and Wallis' 1952 paper make explicit that the inference of location shift is tied to the assumption of "same form". I do not think that we disagree that one can use the test with this assumption, but the test can be used more generally. $\endgroup$ – Alexis Nov 22 '19 at 15:57

There are a couple of approaches that may be helpful.

First, if you can determine the distribution of your data, a generalized linear model (possibly as a mixed-effects model to account for the repeated measures) may work. The distribution of the data may be inferred from the nature of the data. (That is, if it is positive values that might be skewed, perhaps Gamma; if it count data, perhaps a negative binomial; if it is proportion data between 0 and 1, beta. You can look up these distributions on, say, Wikipedia.) There are also tools that can match the (conditional- or residual-) data to these distributions. (See, for example, the fitdistrplus R package).

Second, for a general non-parametric approach that can handle interactions and repeated measures (mixed effects) designs, there's aligned ranks transformation anova. The ARTool software can be run in R or Windows. It's a very flexible approach, but it has limitations. Read the documentation.

Finally, if you are really into transformations, you might try some more flexible approaches. Box-Cox transformation is useful because it takes into the account the whole model. (But you'd have to simplify your model to a general linear model.) On single variables, there's Tukey's ladder of transformations, and the occasionally miraculous normal scores transformation.

Also, sometimes changing your model helps. If there is another factor or interaction you can include, sometimes that makes a huge difference.

  • $\begingroup$ Hey Salvatore, thank you for your answer! Your input already helped me a lot. My samples sizes are rather small n=7 (sub-group1) n=9 (sub-group 2) across all groups. the distribution actually looks like a Gamm distribution which is situated between 0 and 1 meaning most of the values remain under 0.3 and only few exceed 0.5. I had two long days reading on normality. Now I think an arsin transformation might help (arsin ( sqrt ( old value ) ) – 0.2854). Do you have any special recommendations for small sample sizes? Cheers $\endgroup$ – andyfilip Nov 29 '19 at 13:52
  • $\begingroup$ I don't have any further specific suggestions. $\endgroup$ – Sal Mangiafico Nov 29 '19 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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