Home > Community > Is there a non-parametric equivalent of a 2-way ANOVA?
Upvote

30

Downvote
+ Physiology
+ Anova
+ Advanced statistical analysis
+ Data analysis
Posted by
Kenny James

Is there a non-parametric equivalent of a 2-way ANOVA?

Daniel Chetcuti  Follow

The KW Test is for the one factor case only.
In the two factor case, we have limited options available.
When one of the two factors is a blocking factor, the we can use Friedman's Test for a nonparametric Randomized Complete Block Design.
With a factorial experiment with two (or more factors), I opt for a rank based method that works very well. Some would call it "robust" and not nonparametric, but it explained well in the text by William Conover. I mean the Normal Scores Test that is similar to what originally Van der Waerden proposed as a test with Asymptotic Relative Efficiency of at least 1.
Basically, we map the ordered array of raw data into a standard normal distribution, and we use the corresponding z values, or the normal scores. Among all proposed rank based tests, only this tests has been shown to have an acceptable test for interaction. Main effects tests have no problems for many rank based tests as each main effect is like a one factor case.
In SAS, I prefer the BLOM option for the normal scores. I have been using this approach for several years now. I do not know of any other valid options here.
A nice plus for this method is making the interpretations of the results much easier since z scores follow a Normal (0,1) distribution, and the differences are expressed in standard errors.

More

Upvote

VOTE

Downvote
Attah Peter  Follow

You can use the Scheirer–Ray–Hare test in R as well. See how: https://rcompanion.org/handbook/F_14.html
There are some recommendations for post-hoc test.
Best regards, Gizella

More

Upvote

VOTE

Downvote
Christian Richardson  Follow

Well, it means that your dependent variable rMCST is different respective to the two factors, but with no interaction between factors. Note that p=0.051 is ok.
Then you should use post-hoc tests between groups for each factor, such as a Mann-Withney (with bonferonni corrections). You may also plot data according to factors boxplot(Y~F1)

More

Upvote

VOTE

Downvote
David Petersen  Follow

Dear Robert,
Take a look at the Sokal and Rohlf's "Biometry"  (chapter 13, page 446 of the third edition, that I have). There you will find the Scheirer-Ray-Hare extension of the Kruskal Wallis test, which meets your need. You can perform part of the test in SPSS (data ranking and two-way anova of the ranked data). You have to use the spss output to calculate the SS/MS  values (which is the H value) for each factor and interaction. The significance of H is tested as a chi-square variable, with the degrees of freedom pertaining to the SS being tested. This is how I do it.
Good luck.  
PS: If you need a post-hoc analysis after that, use Mann-Whitney U test with Bonferroni correction of alpha for the number of comparisons (divide alpha by the number of comparisons).
All the best,
Carlos

More

Upvote

VOTE

Downvote
Daniel Gardini  Follow

BTW to be more precise, the first number is the equivalent of F value and the second is the p value for each factor. You should report the DF too(degree of freedom). See: https://www.statology.org/how-to-report-two-way-anova-results/


## 2-way ANOVA on trimmed meanst2way(rMCST ~ rT * rR, data = data)

F value p.value
rT 3.8978 0.051
rR 10.2816 0.002
rT:rR 0.8471 0.359
## post hoc testsmcp2atm(rMCST ~ rT * rR, data = data) #fake values

psihat ci.lower ci.upper p-valuerT1 10.00000 -6.00223 26.00223 0.020922 *rR1 35.83333 19.32755 52.33911 0.00003 **rR2 39.16667 22.46796 55.86537 0.00001 **rT:rR1 -3.33333 -20.49551 13.82885 0.61070 nsrT:rR2 -29.16667 -45.67245 -12.66089 0.9 ns
psihat is the equivalent of t for trimmed mean comparisons

More

Upvote

VOTE

Downvote
Brian Bi  Follow
Upvote

VOTE

Downvote
David L. Avery  Follow

Thank you very much for your help. Would you mind taking a look at what I did (and hope is correct)?

tM_R1 <- mean(df$rMCST[df$rR=='R1'], tr = 0.2, na.rm = T)
tM_R2 <- mean(df$rMCST[df$rR=='R2'], tr = 0.2, na.rm = T)
tV_R1 <- winvar(df$rMCST[df$rR=='R1'], tr = 0.2, na.rm = T)
tV_R2 <- winvar(df$rMCST[df$rR=='R2'], tr = 0.2, na.rm = T)
n_R1 <- length(df$rR[df$rR=='R1'])
n_R2 <- length(df$rR[df$rR=='R2'])
tSD_R <- sqrt(((n_R1-1)*tV_R1+(n_R2-1)*tV_R2)/(n_R1+n_R2-2))
d_rMCST_rR <- (tM_MCR_R2-tM_MCR_R1)/tSD_R
d_rMCST_rR
f_rMCST_rR <- sqrt(n_R1*n_R2/(n_R1+n_R2)^2)*d_rMCST_rR
f_rMCST_rR

Also, I am not sure about doing post-hoc tests with mcp2atm(). Do they make sense when I only have significant main effects (no interaction) for factors with only 2 levels?

More

Upvote

VOTE

Downvote
Mohamed Garnett  Follow

Bonjour,
Your scripts look good to me. For the post-hoc tests, I haven't checked what's under the hood for this function. However, according to the output of your ANOVA, you should find significant differences for the main effects only. Is that right?
Also, I would suggest providing the CI to the reader.
BTW, t2way does not report any degrees of freedom since an adjusted critical value is used.


More

Upvote

VOTE

Downvote
David Min  Follow

Salvatore S. Mangiafico , thank you for your recommendation. :-)


More

Upvote

VOTE

Downvote
Carl Dodd  Follow

Gizella Jahnke , In many circumstances, I would recommend some more contemporary methods instead of the S-R-H test. For continuous data, aligned ranks transformation anova. For ordinal data, ordinal regression.

More

Upvote

VOTE

Downvote
Albert Hsieh  Follow

Thank you very much Fabien, that's exactly what I've been looking for! Do you also know how to calculate effect sizes for the ANOVA on trimmed means?

More

Upvote

VOTE

Downvote
Camille Mayers  Follow

You're welcome.
For the effect sizes, you mean the Cohen index?
I'd say that it is just the difference in trimmed means divided by the pooled standard deviation. (https://en.wikipedia.org/wiki/Effect_size#Cohen's_d)
See the trimse function that will help you to calculate trimmed mean and trimmed (winsorized) variance. Then calculate the winsorized pooled SD (sqrt of the weighted sum of variances).

https://cran.r-project.org/web/packages/WRS2/WRS2.pdf

BTW, do not forget that web search engines are your friends especially for R. Learning by yourself is the best way.
Nevertheless, since some parts may be mysterious, I'm willing to help you, if you work enough !!! ;+)

More

Upvote

VOTE

Downvote