The Wilcoxon signed-rank test for the median of a single population is a nonparametric test used to evaluate whether the median of a population differs from a specified value. Unlike parametric tests, it does not require data to follow a normal distribution, making it suitable for non-normal or small samples. The test begins by calculating the difference (d) between each observation and the hypothesized median. The absolute values of these differences are ranked in ascending order, with ties averaged. Each rank is then assigned the original sign of the corresponding d-value, creating a set of signed ranks.
The next step is to separately sum the positive and negative signed ranks. The test statistic is based on the smaller of these two sums (absolute value), which reflects the degree of symmetry around the hypothesized median. The sample size (n) is the number of non-zero d-values (differences that are not exactly zero). Based on n and the distribution of signed ranks, the test statistic is evaluated against critical values for a given significance level to determine whether to reject the null hypothesis that the sample median equals the hypothesized value. The Wilcoxon signed-rank test is particularly useful for data that deviates from normality, as it accounts for both the magnitude and direction of differences, unlike the simpler sign test, which only considers direction

In both cases, the critical Z-value is obtained from its table for a particular significance level and sample size n. The null hypothesis is rejected if the test statistic, T, is lower than the critical value.
Consider an example of a novel rice variety genetically modified to produce longer rice grains.
To know if the grain length of the novel variety is significantly different from the natural population of rice or wildtype, 12 such grain lengths are compared with the median of grain lengths of the wildtype.
Here, the null hypothesis that no difference exists between the grain lengths of the novel and wildtype rice varieties can be tested using the Wilcoxon signed-ranks test.
First, calculate d by subtracting the median from each sample value.
Now, assign preliminary ranks to each value of d and calculate the actual ranks.
Assign appropriate signs to all.
Calculate the sum of positive and negative ranks separately.
Ignore the signs of these sums and take the smaller value as the test statistic T.
Get a two-tailed critical value at n = 12 at a significance level 0.05 from the standard table to compare it with T.
As the critical value is larger than the test statistic, the null hypothesis is rejected.