Solved – non-parametric alternative to Two-Way Repeated Measures Anova

anovamanovanonparametricrepeated measuresspss

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.

Best Answer

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:

set.seed(1121)
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
set.seed(2019)
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.

Related Question