Skip to content

Main content

Mann-Whitney U Test Calculator Source Code

Browse the implementation files for Mann-Whitney U Test Calculator.
tool.ts typescript
import { calculateMannWhitneyU as calculatePortableMannWhitney } from '@tool.io/tools/statistics/mann-whitney-u';

export const calculateMannWhitneyU = (
	first: unknown,
	second: unknown
): string => {
	const result = calculatePortableMannWhitney({
		first,
		second
	});
	return result.ok
		? JSON.stringify(result.output, null, 2)
		: '';
};

export const Tool: TypeTool = {
	name: 'Mann-Whitney U Test Calculator',
	slug: 'statistics/mann-whitney-u',
	intro:
		'Calculate the Mann-Whitney U statistic for two independent samples.',
	tool: calculateMannWhitneyU,
	i: [
		{
			example: '1, 3, 5, 7',
			label: 'First Sample',
			placeholder: 'Numeric values',
			render: 'textarea',
			type: 'text'
		},
		{
			example: '2, 4, 6, 8',
			label: 'Second Sample',
			placeholder: 'Numeric values',
			render: 'textarea',
			type: 'text'
		}
	],
	o: [
		{
			example: '{ "statistic": 6 }',
			label: 'U-Test Result',
			placeholder: 'Result will appear here...',
			render: 'textarea',
			type: 'text'
		}
	]
};

export default Tool;

Description

Browse the implementation files for Mann-Whitney U Test Calculator.

References

  1. Tool.io on GitHub
  2. Tool.io TypeScript tools library

Similar or alternative tools