Title

srh_test -- Scheirer-Ray-Hare nonparametric two-way analysis of variance test

Syntax

srh_test depvar factor_var1 factor_var2 [if] [in]

Description

srh_test performs the Scheirer-Ray-Hare (SRH) test, a nonparametric alternative to two-way factorial ANOVA. The test was introduced by
Scheirer, Ray, and Hare (1976) as an extension of the Kruskal-Wallis one-way test to designs with two crossed factors and their interaction.

The command displays the standard ANOVA table augmented with two additional columns, H, the Scheirer-Ray-Hare test statistic for each term,
and Prob>chi2, the p-value for H based on the chi-squared distribution with degrees of freedom equal to those of the term.

Like the Kruskal-Wallis test, the SRH test does not require normality. It assumes that observations are independent and that the response variable
is at least ordinal. The chi-squared approximation improves with larger sample sizes; results should be interpreted cautiously in small samples.

The SRH test is intended for balanced factorial designs, where every combination of factor_var1 and factor_var2 levels contains
the same number of observations. With unbalanced designs the test may produce unreliable results, because the sums of squares and MS(total) are
distorted when cell sizes differ. If the design is unbalanced, alternative approaches should be considered.

The SRH test has lower statistical power than parametric two-way ANOVA and is considered conservative relative to the parametric alternative
(Dytham 2003). When the normality assumption of parametric ANOVA is plausible, that test is preferred. Post-hoc pairwise comparisons should
be performed separately if significant effects are found.

Saved results

srh_test runs anova internally and all e() results
from that call remain available after the command returns. These include:

e(N) number of observations

e(mss) model sum of squares

e(rss) residual sum of squares

e(df_m) model degrees of freedom

e(df_r) residual degrees of freedom

e(F) overall F statistic

e(r2) R-squared

e(ss_k) sum of squares for term k

e(df_k) degrees of freedom for term k

e(F_k) F statistic for term k

Example

Two-way factorial design

. webuse systolic

. srh_test systolic drug disease

Compare to two-way factorial ANOVA

. anova systolic drug##disease

References

Dytham, C. 2003.
Choosing and Using Statistics: A Biologist's Guide, 2nd ed.
Oxford: Blackwell. pp. 145-150.

Scheirer, C. J., Ray, W. S., and Hare, N. 1976.
The analysis of ranked data derived from completely randomized factorial
designs.
Biometrics 32(2): 429-434.
https://www.jstor.org/stable/2529511

Wikipedia. 2015.
Scheirer-Ray-Hare test.
https://en.wikipedia.org/wiki/Scheirer%E2%80%93Ray%E2%80%93Hare_test

Author

Ariel Linden

Linden Consulting Group, LLC

alinden@lindenconsulting.org

Citation of srh_test

srh_test is not an official Stata command. It is a free contribution
to the research community, like a paper. Please cite it as such:

Linden, A. 2026. SRH_TEST: Stata module for computing the Scheirer-Ray-Hare nonparametric two-way analysis of variance test.

Also see

anova, kwallis, ranksum, dunntest (if installed)