@tpmjs/tools-permutation-test
Perform a permutation test to assess the statistical significance of the difference in means between two groups. Returns p-value, observed difference, and significance status. Useful for non-parametric hypothesis testing without assuming normal distribution.
Test @tpmjs/tools-permutation-test (permutationTestTool) with AI-powered execution
0/2000 characters
Install this tool and use it with the AI SDK
npm install @tpmjs/tools-permutation-testpnpm add @tpmjs/tools-permutation-testyarn add @tpmjs/tools-permutation-testbun add @tpmjs/tools-permutation-testdeno add npm:@tpmjs/tools-permutation-testimport { permutationTestTool } from '@tpmjs/tools-permutation-test';import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { permutationTestTool } from '@tpmjs/tools-permutation-test';
const result = await generateText({
model: openai('gpt-4o'),
tools: { permutationTestTool },
prompt: 'Your prompt here...',
});
console.log(result.text);Available configuration options
group1arrayFirst group of numeric values
group2arraySecond group of numeric values
iterationsnumberNumber of permutations to perform (default: 10000)
Schema extracted: 1/1/2026, 8:17:43 AM
Perform a permutation test to assess the statistical significance of the difference in means between two groups.
npm install @tpmjs/tools-permutation-test
import { permutationTestTool } from '@tpmjs/tools-permutation-test'; // Use with AI SDK const result = await permutationTestTool.execute({ group1: [23, 25, 27, 29, 31], group2: [18, 20, 22, 24, 26], iterations: 10000, // optional, default: 10000 }); console.log(result); // { // pValue: 0.0234, // observedDiff: 5, // significant: true, // iterations: 10000, // metadata: { // group1Size: 5, // group2Size: 5, // group1Mean: 27, // group2Mean: 22, // alpha: 0.05 // } // }
{ pValue: number; // Two-tailed p-value observedDiff: number; // Absolute difference in means significant: boolean; // Whether p < 0.05 iterations: number; // Number of permutations performed metadata: { group1Size: number; group2Size: number; group1Mean: number; group2Mean: number; alpha: number; // Significance level (0.05) } }
The permutation test is a non-parametric method that doesn't assume normal distribution:
MIT
Downloads/month
36
Quality Score