# Kruskal-Wallis / Wilcoxon

Both Kruskal-Wallis and Wilcoxon tests are rank tests, such rank-based tests are generally advised for use with larger sample sizes. They both can only take one factor into account at a time. Kruskal-Wallis can perform on an attribute with two or more subgroups.

Wilcoxon test is a close alternative to Kruskal-wallis task, match the results of [scany Wilcoxon method](https://scanpy.readthedocs.io/en/stable/generated/scanpy.tl.rank_genes_groups.html). This test is also called "Wilcoxon Rank-Sum Test" or "Mann-Whitney U Test". When you perform comparisons on the two groups, it will filter only include the two groups first and then perform the differential analysis.

## Running the task

To invoke the Kruskal-Wallis test, select any count-based data nodes, these include:

* Gene counts
* Transcript counts
* Normalized counts

After clicking on the chosen node:

* Select *Statistics > Differential analysis* in the context-sensitive menu.
* Select *Kruskal-Wallis or Wilcoxon.*
* Select a specific factor for analysis and click the **Next** button to setup the comparisons.

<figure><img src="https://580316046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWMxqQAMFOJtu98OBk9KN%2Fuploads%2Fgit-blob-df202358bb47abd8a2a3fe90f08ce2306447ad52%2Fimage%20(14)%20(1)%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**Note**: Wilcoxon test will filter the data to include the observations in the two comparison groups to generate p-value, while Kruskal-Wallis will use all the samples in the input data to generate p-value on the selected attribute.
{% endhint %}

* Define the comparisons by dragging and dropping each group in the *Denominator* and *Numerator* boxes and click **Add comparison**

<div align="left"><figure><img src="https://580316046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWMxqQAMFOJtu98OBk9KN%2Fuploads%2Fgit-blob-294df0791e90fdba157dc96c410d80f3a2067f34%2Fimage%20(327).png?alt=media" alt=""><figcaption></figcaption></figure></div>

If the data has not been filtered upstream the **Low value filter** box will be checked by default. Similarly, the **Default** normalisation will be selected if the software detects that the data as not been previously normalised.

<figure><img src="https://580316046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWMxqQAMFOJtu98OBk9KN%2Fuploads%2Fgit-blob-3932c31f9071355cd13247ed451a2c084c041b32%2FScreenshot%202025-07-30%20at%2015.17.59.png?alt=media" alt=""><figcaption></figcaption></figure>

## Advanced option

If there are tied ranks of feature expression values, the default is not use tie correction which is corresponding to the scanpy.tl.rank\_genes\_groups(tie\_correct = False).

<div align="left"><figure><img src="https://580316046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWMxqQAMFOJtu98OBk9KN%2Fuploads%2Fgit-blob-908a287df613ea75f905057287698c77dd69c8fd%2Fimage%20(328).png?alt=media" alt=""><figcaption></figcaption></figure></div>

The results of the analysis will appear similar to other [ANOVA/LIMMA-trend/LIMMA-voom](https://help.connected.illumina.com/icm/analyses/analysis-functionality/task-menu/statistics/differential-analysis/anova-limma-trend-limma-voom). However, the column to indicate mean expression levels for each group will display the median instead for Kruskal-Wallis.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.connected.illumina.com/icm/analyses/analysis-functionality/task-menu/statistics/differential-analysis/kruskal-wallis-1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
