Skip to main content

Testing Numeric Data Using Rank-Based Statistics

numeric_rank_test() is an interface to a set of statistical methods to test whether the distribution of a numeric outcome differs between groups.

The function takes inputs:

One method estimates a stratified statistic, so a thrid qualitative variable is required for method = "wilcoxon_stratified".

These comparisons are specific to asymptotic test statistics since that is the method common to segue and SAS.

Experimental Setup

These methods are often used in clinical analyses as fallbacks for situations where parametric distributional assumptions of the data are not met for the intended hypothesis test (e.g., non-normal residuals for an ANOVA).

To evaluate equivalence between segue and R, we generated simulated data sets with an exponentially distributed outcome whose parameter differs across groups (but not strata). The data sets consisted of 200 data points. One grouping variable (x) contained two balanced groups, and another (z) had three roughly balanced groups, each with their own exponential parameter value.

For 100 simulated data sets, the comparison conditions were:

  • Alternative hypotheses (when possible).
  • Frequency of ties. Outcome data were rounded to either 10 or 1 decimal place. For the former, each outcome value has an overwhelming probability of being unique. For a single decimal place, the two-group data contained about 13.7 unique values (on average, out of 200) and the three-group case produced about 18 unique outcome values.

The simulation and rounding were computed in R.

To measure the difference, we consider the absolute difference in the resulting p-values.

Resources:

  • Help Page Details Section
  • link to file code coverage

Wilcoxon Rank Sum Test

method = "wilcoxon"

Of the total of 800 p-values computed for this comparison, 0 were missing. The two methods showed excellent concordance, with absolute differences ranging from −5.90 × 10−17 to 4.34 × 10−19.

Absolute differences in Wilcoxon test p-values.

Stratified Wilcoxon Rank Sum Test

method = "wilcoxon_stratified"

For this test, only two-sided alternatives are available. Of the total of 400 p-values computed for this comparison, 0 were missing. The two methods also showed excellent concordance, with absolute differences ranging from −5.83 × 10−16 to 3.89 × 10−16.

Absolute differences in stratified Wilcoxon test p-values.

Kruskal Wallis Test

method = "kruskal_wallis"

For this test, only two-sided alternatives are available. Of the total of 400 p-values computed for this comparison, 0 were missing. The two methods also showed excellent concordance, with absolute differences ranging from −2.14 × 10−14 to 4.52 × 10−15.

Absolute differences in Kruskal Wallis test p-values.