> ## Documentation Index
> Fetch the complete documentation index at: https://doc.lucidworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Mann-Whitney (mann_whitney)

export const LwTemplate = ({title = "Key questions to get you started", icon = "sparkles", cta = "Powered by Agent Studio", linkHref = "https://lucidworks.com/demo/?utm_source=docs&utm_medium=referral&utm_campaign=docs_cta_ai"}) => {
  const [isLoaded, setIsLoaded] = useState(false);
  useEffect(() => {
    const timer = setTimeout(() => {
      setIsLoaded(true);
    }, 500);
    return () => clearTimeout(timer);
  }, []);
  return <div className="lw-template-container">
      <Card title={title} icon={icon}>
        {isLoaded && <span dangerouslySetInnerHTML={{
    __html: `<lw-template id="a029c1a9-28be-427e-b0e1-5d918920246a"></lw-template
            >`
  }} />}
        <Link href={linkHref} className="agent-studio-link text-left text-gray-600 gap-2 dark:text-gray-400 text-sm font-medium flex flex-row items-center hover:text-primary dark:hover:text-primary-light group-hover:text-primary group-hover:dark:text-primary-light">Powered by Lucidworks Agent Studio</Link>
      </Card>
    </div>;
};

[localhost link]: http://localhost:3000/docs/4/fusion-server/reference/fusion-sql/mann_whitney

[mintlify link]: https://doc.lucidworks.com/docs/4/fusion-server/reference/fusion-sql/mann_whitney

[old doc.lw link]: https://doc.lucidworks.com/fusion-server/4.2/3275

The `mann_whitney` function performs a Mann-Whitney U-test on two random samples drawn with different queries. The `mann_whitney` function takes four parameters:

1. the numeric field to perform the Mann-Whitney U-test on
2. the Lucene/Solr query for drawing the first sample
3. the Lucene/Solr query for drawing the second sample
4. the sample size for both samples

<LwTemplate />

## Sample syntax

```sql wrap  theme={"dark"}
select mann_whitney(sepal_width_d, "species_s:versicolor", "species_s:virginica", 150) as u,
       p_value
from iris
```

## Result set

The result set for the `mann_whitney` function contains one row with the results of the `mann_whitney` test. The `mann_whitney` function returns the U-statistic. The `p_value` field can be selected to return the p-value for the Mann-Whitney test.

Sample result set in Apache Zeppelin

<img src="https://mintcdn.com/lucidworks/iN-DD0xMOO3PKUmX/assets/images/5.2/udf/mann_whitney1.png?fit=max&auto=format&n=iN-DD0xMOO3PKUmX&q=85&s=3d9ac030e0d42c7403e9d2743c96096c" alt="Sample result" width="1900" height="1098" data-path="assets/images/5.2/udf/mann_whitney1.png" />

## Visualization

Sample visualization of the `mann_whitney` function using the Apache Zeppelin number visualization:

<img src="https://mintcdn.com/lucidworks/aGMTh7KKUIwUyuv7/assets/images/5.2/udf/mann_whitney2.png?fit=max&auto=format&n=aGMTh7KKUIwUyuv7&q=85&s=d91517f910d3feb27dff8c71697151cb" alt="Sample visualization" width="1910" height="1148" data-path="assets/images/5.2/udf/mann_whitney2.png" />
