One-Sample Wilcoxon Signed-Rank Test

about statistical-calculators.site

Sample Data (n=0)

Hypothesized Median (\(\eta_0\))

Your results will be displayed here.

Understanding the One-Sample Wilcoxon Signed-Rank Test

The One-Sample Wilcoxon Signed-Rank Test is a non-parametric test that determines whether the median of a sample is equal to a specific, hypothesized value. It is the non-parametric equivalent of the one-sample t-test and is used when the data cannot be assumed to be normally distributed.

When to Use this Test

This test is appropriate when you have a single set of data and want to compare its median to a known standard, target, or theoretical value. For example, you could use it to test if the median pH of a chemical solution is 7.0, or if the median score on a test is different from a national average of 80.

Assumptions of the Test

Interpreting the Results

The test works by calculating the differences between each data point and the hypothesized median, ranking the absolute values of these differences, and summing the ranks of the positive and negative differences. The output includes:


Frequently Asked Questions (FAQ)

Q1: How is the W statistic calculated manually?

The calculation follows these steps:

  1. For each data point \(x_i\), calculate the difference from the hypothesized median \(\eta_0\): \(d_i = x_i - \eta_0\).
  2. Discard any data points where the difference is zero. Let the remaining count be \(n\).
  3. Take the absolute value of each non-zero difference, \(|d_i|\).
  4. Rank these absolute differences from 1 (smallest) to \(n\) (largest), averaging ranks for any ties.
  5. Sum the ranks of the original positive differences to get \(W^+\).
  6. Sum the ranks of the original negative differences to get \(W^-\).
  7. The test statistic, \(W\), is the smaller of the two sums: \(W = \min(W^+, W^-)\).

Q2: What is the difference between the one-sample and paired-sample Wilcoxon tests?

Q3: How is the Z-approximation calculated for this test?

For larger sample sizes (e.g., \(n > 20\)), a normal approximation with a Z-score is used to find the p-value. The Z-score is calculated as:

$$ Z = \frac{W - \mu_W}{\sigma_W} $$

Where \(\mu_W\) is the mean and \(\sigma_W\) is the standard deviation of the W distribution:

Q4: What are the null and alternative hypotheses?

The hypotheses test the population median, denoted by \(\eta\), against the hypothesized median, \(\eta_0\):

How to Do This in Statistical Software

Using this calculator's default sample data (5.2, 5.5, 4.8, 4.9, 5.9, 6.1, 5.8, 6.5, 4.5, 5.3, 5.7 vs. hypothesized median 5.0), here's how to run the same test elsewhere.

RStudio

R's wilcox.test() handles the one-sample case directly via the mu argument:

x <- c(5.2, 5.5, 4.8, 4.9, 5.9, 6.1, 5.8, 6.5, 4.5, 5.3, 5.7)
        
        wilcox.test(x, mu = 5.0, correct = TRUE)

Python

scipy.stats.wilcoxon tests differences from zero directly, so subtract the hypothesized median from your data first:

from scipy.stats import wilcoxon
        
        x = [5.2, 5.5, 4.8, 4.9, 5.9, 6.1, 5.8, 6.5, 4.5, 5.3, 5.7]
        hypo_median = 5.0
        differences = [v - hypo_median for v in x]
        
        stat, p = wilcoxon(differences, mode='approx', correction=True)
        print(stat, p)

SPSS

Analyze → Nonparametric Tests → Legacy Dialogs → 1-Sample Wilcoxon Signed Rank Test isn't a built-in legacy menu item; the standard workaround is Analyze → Nonparametric Tests → One Sample, using the Customize Analysis tab to select the Wilcoxon Signed-Rank test and setting the hypothesized median.

JASP

T-Tests → One Sample T-Test. Move your variable into the Variables box, set Test value to your hypothesized median, and under Tests uncheck Student and check Wilcoxon signed-rank instead. JASP outputs the W statistic and p-value directly.

Related Statistical Calculators