| Group | Height | Weight | Yield |
|---|---|---|---|
| Treatment | 12.5 | 25.1 | 102 |
| Treatment | 15.2 | 28.3 | 110 |
| Treatment | 11.8 | 24.9 | 98 |
| Treatment | 14.3 | 27.5 | 105 |
| Treatment | 13.7 | 26.8 | 101 |
| Treatment | 16.1 | 29.4 | 115 |
Mann-Whitney U test
The Mann-Whitney U test compares two independent groups without assuming normally distributed data. This tutorial explains how the rank-sum logic works and how to run the whole analysis in RAISINS… Read more …
The Mann-Whitney U test (equivalently the Wilcoxon rank-sum test) is the nonparametric counterpart to the two sample t-test: it compares two independent groups when the data are ordinal, clearly non-normal, or too small in number to trust a normality check. It works on the ranks of the pooled observations rather than on the raw values themselves, so it does not require the response to be normally distributed. This tutorial explains what the test actually does, when to reach for it instead of the t-test, and walks through a complete analysis in RAISINS - data preparation, running the test, reading the U (W) statistic and confidence interval, the six built-in plot types, and AI-assisted interpretation with RA-One - all without writing a single line of code.
1 What is the Mann-Whitney U test?
Suppose you compare a new rice variety against an older one, but the yield data you collected are skewed, contain a couple of extreme plots, or the sample is simply too small to trust a normality test one way or the other. A two sample t-test asks whether the two group means differ once you account for noise, and that logic depends on the data being at least roughly normal within each group. When that assumption is shaky, you need a test that asks a similar question without leaning on it.
The Mann-Whitney U test (also called the Wilcoxon rank-sum test) does exactly that. Instead of comparing raw values, it pools every observation from both groups, ranks them from smallest to largest, and then asks:
Do the ranks from Group A tend to be systematically higher or lower than the ranks from Group B?
If the two groups come from the same underlying distribution, their ranks should be thoroughly mixed - roughly half of each group’s ranks in the top half, half in the bottom half. If one group’s values are consistently larger, its ranks will cluster toward the top. The test turns this idea into a single statistic, the U statistic (RAISINS reports it in the “W value” column, using R’s wilcox.test() convention):
\[U = R_1 - \frac{n_1(n_1+1)}{2}\]
where \(R_1\) is the sum of the ranks in Group 1, and \(n_1\) is its sample size. A U value far from what you’d expect by chance means the groups differ; a U value close to the chance expectation means they don’t.
The Mann-Whitney U test compares two independent groups using the ranks of the combined data rather than the raw values, so it does not require the response variable to be normally distributed.
1.1 The p-value
Just like the t-test, RAISINS converts the rank-sum statistic into a p-value:
If the two groups were genuinely drawn from the same distribution, how often would I see rank sums this lopsided purely by chance?
A small p-value (conventionally p < 0.05) means the observed split in ranks would be unusual under “no difference,” so that explanation becomes hard to believe. A large p-value means the ranks are unremarkable, and you have not found evidence of a difference.
Because it works on ranks, the Mann-Whitney U test is best understood as comparing the distributions (and, under the common assumption of similarly shaped distributions, the medians) of the two groups, not their means. If one group’s values are shifted up or down relative to the other, the test picks that up regardless of the exact shape of the distribution.
A little history: two tests, one idea
-
The rank-sum idea was published twice, independently, within a few years. Frank Wilcoxon introduced the rank-sum test for two independent samples in 1945. In 1947, Henry Mann and his student Donald Whitney derived an equivalent statistic (the U statistic) with a cleaner sampling distribution and extended the theory considerably. The two formulations are mathematically interchangeable - R’s
wilcox.test() computes the Mann-Whitney U statistic but reports it under the Wilcoxon name for two-sample data, which is why you will see both names used for the same test in the literature and in RAISINS.
2 When to use it instead of a t-test
| Situation | Use |
|---|---|
| Data are approximately normal within each group | Two sample t-test (see the t-test tutorial) |
| Data are clearly skewed, ordinal (ranks, ratings, scores), or contain influential outliers | Mann-Whitney U test |
| Sample is small and normality cannot be verified with confidence | Mann-Whitney U test, or a t-test after transformation |
| The same individuals were measured twice (before/after) and the differences are non-normal | The Wilcoxon signed-rank test (available in RAISINS as the “Paired” option) |
The Mann-Whitney U test compares exactly two groups. If your design has three or more groups, use the Kruskal-Wallis test instead (a separate RAISINS module) - it is the direct multi-group extension of the same rank-based logic.
RAISINS itself points you here: if a variable’s normality test is unsatisfactory in the t-test module and a transformation does not fix it, the recommended next step is the Mann-Whitney U test. If your two measurements come from the same experimental units (e.g. before and after a treatment), tick the Paired option in RAISINS instead of treating the observations as independent - the underlying computation switches to the Wilcoxon signed-rank test on the paired differences, and the statistic is then labelled “V value” rather than “W value.”
3 Assumptions
| Assumption | What it means | What if it fails? |
|---|---|---|
| Independence | Each observation is unrelated to the others; use the Paired option if this is violated by design | Serious - handled by good experimental design, not at the analysis stage |
| Ordinal or continuous response | The measurement can be meaningfully ranked | If the data are purely categorical, use a test designed for categories |
| Similar distribution shape (for the median interpretation) | Both groups’ distributions have roughly the same shape, just possibly shifted | The test remains a valid test of “which group tends to have larger values,” even if the median interpretation becomes less precise |
Unlike the t-test, the Mann-Whitney U test does not require normally distributed data, and it is far less sensitive to outliers because it works on ranks rather than raw magnitudes. This robustness is exactly why it exists - it trades a little statistical power (when the data genuinely are normal) for much greater safety when they are not.
4 Getting to the module
Visit the RAISINS home page at www.raisins.live and go to Data Analysis. In this tutorial we use the Mann-Whitney U test module.
4.1 Computational Provenance & Reproducibility Record
CPRR (Computational Provenance & Reproducibility Record) provides a transparent and comprehensive record of the computational workflow behind this module: the R version and the exact version of every package used, the specific function behind each reported result, every default parameter and decision rule applied, and fully runnable R code that reproduces each analytical step. Users can execute the code in R to independently reproduce and verify the results.
To cite the platform itself in a paper, thesis, or report, use the RAISINS citation, available in APA, Harvard, and BibTeX formats at www.raisins.live/citation.html.
The CPRR for the Mann-Whitney U test is at www.raisins.live/module_record/mwu.html.
5 Preview mode and Quick Tour
Before subscribing, you can explore the entire module using Preview mode, accessible from the Welcome page. Preview mode loads built-in datasets so you can try every feature (analysis, plots, and the RA-One assistant) without uploading your own data. First-time users are also offered a Quick Tour, an interactive, step-by-step walkthrough that highlights each control and explains what it does. You can retake the tour at any time from the Quick Tour tab.
6 A working example
This example compares two independent groups, Treatment and Control, with 15 observations each (this is the same worked example used in the RAISINS t-test tutorial, so the two can be compared side by side). Three response variables were recorded for every experimental unit - Height, Weight, and Yield. Each variable is compared between the two groups independently, producing its own Mann-Whitney U result.
7 How to prepare your data
Your analysis is only as good as your data. You have four routes:
- Create your dataset in MS Excel
- Build your dataset directly within the RAISINS app
- Use the Model datasets in RAISINS as a reference
- Create your dataset using the RA-One chat assistant
7.1 Preparing data in MS Excel
Open a new blank sheet in MS Excel containing only one sheet. The dataset should follow a column-based (long) format: the first column holds the group label for the two independent groups being compared (e.g. “Treatment” and “Control”, or “Group A” and “Group B”), and every response variable under study (e.g. Height, Weight, Yield) occupies its own column. Each group label repeats once per observation in that group - unequal group sizes are perfectly fine for Mann-Whitney, unlike many balanced-design methods. The file can be saved as CSV, XLS, or XLSX; CSV is recommended as it is lighter and loads faster.
Dataset creation rules
- Column naming convention
- No spaces allowed in column names.
- Use underscores (
_) or full stops (.) for separation. - Avoid symbols and special characters such as %, #.
- Data arrangement
- Start the data towards the upper-left corner.
- Ensure the row above the data is not blank.
- Group labels
- The group column must contain exactly two distinct labels corresponding to the two groups being compared.
- Keep spelling and capitalisation of group labels consistent throughout the column.
- Group sizes may be equal or unequal.
7.2 Prepare using Create Data in RAISINS
If you are unsure about the correct format, RAISINS can build a blank data layout for you:
- Navigate to the Create Data tab
- Enter the number of columns and the number of observations
- Click Generate Dataset
- Edit the generated Group column so it contains exactly two repeated group labels, then fill in the response values
You may enter the values manually into the generated table, or paste them straight in from Excel. Once entered, download the CSV and upload it under the Analysis tab. If you would rather start from a template that is already arranged into two groups with a chosen sample size, ask the RA-One chat assistant instead (Section 7.4) - it builds one for you directly in the conversation.
7.3 Download Model Datasets
If you would like to explore the module before uploading your own data, RAISINS provides model datasets for reference under the Datasets tab. Download a file, use it as a reference for preparing your own data, or upload it directly to explore the analysis.
7.4 Creating a dataset using RA-One chat
RA-One, the built-in chat assistant, can also build a properly formatted dataset through a simple conversation. Open the RA-One tab (or the floating chat bubble), tell it how many observations you want per group and how many response variables, and it generates an editable data-entry card directly in the chat. Review the values, download the CSV, and upload it under the Analysis tab.
8 The Analysis tab
Upload your prepared file by clicking Browse in the sidebar. Once uploaded, selectors for the Group column and the response Variables appear. Choose the column with exactly two group levels under Group, then select the variable(s) you wish to analyse. You can also switch between a Paired and an Unpaired (independent) comparison depending on your design - refer back to Section 2 if you are unsure which applies.
Click Run Analysis and the outputs appear across the sub-tabs: Analysis Results, Basic Plots, Advanced Plots, AI interpretation, FAQs, and View Data. On the Analysis Results panel you can further adjust the alternative hypothesis (two-tailed, or one-tailed), the significance level (α), the number of decimal digits, and the font.
9 Analysis results
Once your dataset is uploaded and you click Run Analysis, the Mann-Whitney U test is performed for every selected variable. RAISINS reports a Summary Statistics table, an F-test for homogeneity of variance (shown for reference alongside, since some users like to see it, even though - unlike the t-test - the Mann-Whitney U test itself does not depend on this decision), and the Mann-Whitney U (Wilcoxon rank-sum) result table.
| Variable | Treatment (Mean) | Control (Mean) | Treatment (Median) | Control (Median) | W value | p-value | Significance |
|---|---|---|---|---|---|---|---|
| Height | 13.527 | 7.433 | 13.7 | 7.2 | 225 | < 1e-04 | *** |
| Weight | 26.540 | 18.667 | 26.7 | 18.4 | 225 | < 1e-04 | *** |
| Yield | 103.867 | 76.000 | 103.0 | 75.0 | 225 | < 1e-04 | *** |
For Height, the Treatment group (mean 13.53, median 13.70) is clearly shifted above the Control group (mean 7.43, median 7.20): W = 225, p < 0.001. For Weight, Treatment (mean 26.54) exceeds Control (mean 18.67): W = 225, p < 0.001. For Yield, Treatment (mean 103.87) exceeds Control (mean 76.00): W = 225, p < 0.001. A W value of 225 is the maximum possible rank-sum statistic for two groups of 15 (every single Treatment observation outranks every single Control observation for that variable), which is why the p-value is so small in every case - the two groups do not overlap at all on any of the three variables.
Alongside the W statistic, RAISINS reports a 95% confidence interval for the Hodges-Lehmann estimate of the location shift between the groups (the median of all pairwise differences between a Treatment and a Control observation). For Height this interval is approximately (5.00, 7.30); for Weight, approximately (6.60, 9.20); for Yield, approximately (23, 32). None of these intervals contain zero, which is the confidence-interval equivalent of a significant p-value: the true shift between the groups is estimated to be reliably positive.
A significant p-value only says a difference exists; it does not say how large it is. RA-One can compute an effect size r (the rank-biserial correlation, derived from the test’s z-approximation) for your result on request - values are usually interpreted as small (~0.1), medium (~0.3), and large (~0.5) in magnitude. For this working example, the effect size is essentially maximal for all three variables (r ≈ 0.85), consistent with the two groups not overlapping at all.
How the Mann-Whitney result table is built
The null hypothesis states that the two groups come from the same distribution (H₀), and the alternative states that one group tends to have systematically larger values than the other (H₁). RAISINS ranks the pooled observations from both groups, sums the ranks within each group, and derives the U/W statistic from those rank sums. Because ties and small samples make the exact permutation distribution awkward, RAISINS uses the normal approximation (exact = FALSE) with a continuity correction, which is reliable once each group has a handful of observations or more. The computed p-value is compared against the chosen significance level α (0.05 or 0.01 by default). Significance is marked with asterisks: one ( * ) for the 10% level, two ( ** ) for the 5% level, three ( *** ) for the 1% level, and NS for a non-significant result.
If the Paired option is selected, RAISINS instead runs the Wilcoxon signed-rank test on the within-pair differences, and the statistic is labelled “V value.”
10 Plots
The Basic Plots and Advanced Plots sub-tabs use the same icon-based selector found throughout RAISINS: click an icon to switch the active plot, and a gear/settings button opens a full customisation panel (colours, themes, labels, overlays) for whichever plot is showing. Every plot can be downloaded in PNG, JPEG, TIFF, PDF, or SVG format.
| Tab | Plot | What it shows |
|---|---|---|
| Basic Plots | Box & Violin | Combined boxplot and violin, with optional data points, mean markers, and median line - the richest single view of each group’s spread |
| Basic Plots | Raincloud | A half-eye density (“cloud”), boxplot, and jittered points together, showing the full shape of each group’s distribution at a glance |
| Basic Plots | Beeswarm | Every individual observation as a non-overlapping point, arranged so the density of the swarm itself shows where values cluster |
| Basic Plots | Stripchart | A simple jittered scatter with a group median marker - useful for small samples where every point should be visible |
| Advanced Plots | Distribution (Half-Eye) | A density curve with 50% and 95% interval bands per group, for a closer look at each group’s shape |
| Advanced Plots | Q-Q Plot | Checks how closely each group’s values follow a normal distribution - a visual companion to Section 2 when deciding whether Mann-Whitney was the right call in the first place |
11 Interpretation
RAISINS provides a clear, plain-language interpretation of your Mann-Whitney U results under the AI interpretation sub-tab. It summarises which variables show a significant difference between groups, in which direction, and presents the findings in a publication-ready format.
12 Chat with your data using RA-One
RA-One is the built-in conversational assistant for the Mann-Whitney U module, available from the RA-One tab or the floating chat bubble once you are logged in. You ask questions in plain language and it answers using your own analysis rather than generic statistical advice. Every result it discusses is drawn from what the module actually computed - it never invents a W statistic or p-value, and if a value isn’t available it says so instead of guessing. All answers are in plain English, with no code or software commands.
RA-One works directly with your Analysis Results output. It can explain what the W statistic, p-value, and confidence interval mean for your specific groups and variables, clarify when the paired Wilcoxon signed-rank test applies instead, and walk you through when Mann-Whitney is the right choice over a t-test in the first place. It also handles general concept questions - ranks, medians, effect size - so you can build understanding alongside your results.
The same chat window can also prepare your data: it can build a correctly formatted two-group dataset template (Section 7.4) for you to fill in, or fetch a model dataset (Section 7.3) so you can try the module straight away.
RA-One can also generate plots on request, matching the six plot types described in Section 10. Ask for a box and violin plot, a raincloud plot, or a Q-Q plot, and the app renders the graphic directly in the chat, where you can view it and refine it (colours, theme, labels) by asking for changes.
Within a single conversation, RA-One can interpret your results, build a data template, fetch a model dataset, and produce plots - so most of a routine Mann-Whitney session can be conducted without ever leaving the chat window.
13 FAQs
The module includes a dedicated FAQs section to clarify common doubts - for example, when to choose Mann-Whitney over a t-test, how unequal group sizes are handled, and what the paired option changes about the computation.
14 View data
View Data is the primary diagnostic tool for ensuring data integrity before analysis. When you upload your dataset, the system performs an automated health check to validate column types and formatting. For the Mann-Whitney U test this step is especially important: it confirms that the group column contains exactly two unique labels, that all response variable columns are numeric, and that there are no missing or badly formatted entries that could distort the ranking.
15 Wrapping up
The Mann-Whitney U test rests on the same honest question as the t-test - do these two groups genuinely differ? - but answers it using ranks instead of raw means, which makes it the safer choice whenever normality is in doubt, the sample is small, or outliers are a concern. RAISINS automates the ranking, the statistic, the confidence interval, and the plots, so you can concentrate on what the answer means for your research.
If your design has more than two groups, the companion Kruskal-Wallis module extends the same rank-based idea. And if you get stuck at any point, RA-One is available 24 × 7, or write to us at [email protected].


