Implements a comprehensive suite of AI SDK v6 tools across multiple categories: - Research (5): page-brief, compare-pages, source-credibility, claim-checklist, timeline-from-text - Web (10): fetch-text, links-catalog, extract-meta, extract-json-ld, redirect-trace, sitemap-read, rss-read, table-extract, robots-policy, url-normalize - Data (15): csv-parse, csv-stringify, json-repair, json-schema-validate, yaml-parse, yaml-stringify, text-chunk, normalize-whitespace, dedupe-by-key, pivot, rows-filter, rows-sort, rows-group-aggregate, rows-join, schema-infer - Doc (12): toc-generate, glossary-build, faq-from-text, executive-brief, decision-record-adr, prd-outline, acceptance-criteria, style-rewrite - Eng (12): diff-text-unified, env-var-docs-generate, dependency-audit-lite, conventional-commit-suggest, markdown-lint-basic, test-case-generate, stacktrace-parse, release-notes, changelog-entry, release-checklist - Security (7): redact-secrets, secret-scan-text, url-risk-heuristic, csp-compose, hardening-checklist-web, access-control-matrix, data-classification-heuristic - Stats (9): effect-size-suite, bootstrap-ci, permutation-test, multiple-testing-adjust, linear-regression-ols, logistic-regression, time-series-decompose-lite, anomaly-detect-mad - Ops (7): slo-draft, runbook-draft, postmortem-draft, postmortem-action-extractor, error-log-triage, coverage-tracker, monitoring-gap-analysis - Agent (15): prompt-to-workflow-skeleton, workflow-validate-io, workflow-explain, workflow-cost-estimate, tool-call-accuracy-score, eval-fixture-build, guardrail-policy-draft, workflow-auto-repair, tool-selection-plan, novelty-score-workflow, workflow-variant-generate, config-normalize, recipe-* - Utility (8): base64-encode, base64-decode, hash-text, regex-extract, template-render, date-parse, json-path-query, url-parse - HTML (3): html-sanitize, html-to-markdown, markdown-to-html All tools follow AI SDK v6 pattern with tool() and jsonSchema<T>(). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| src | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
| tsup.config.ts | ||
@tpmjs/tools-permutation-test
Perform a permutation test to assess the statistical significance of the difference in means between two groups.
Installation
npm install @tpmjs/tools-permutation-test
Usage
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
// }
// }
Parameters
- group1 (number[], required): First group of numeric values
- group2 (number[], required): Second group of numeric values
- iterations (number, optional): Number of permutations to perform (default: 10000, min: 100, max: 100000)
Returns
{
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)
}
}
How it works
The permutation test is a non-parametric method that doesn't assume normal distribution:
- Calculate the observed difference in means between the two groups
- Combine all values from both groups
- Randomly shuffle the combined data and split into two groups
- Calculate the difference in means for each permutation
- Count how many permutations have a difference as extreme or more extreme than observed
- Calculate p-value as the proportion of extreme permutations
When to use
- When you can't assume normal distribution
- With small sample sizes
- When comparing means between two independent groups
- Alternative to t-test when assumptions aren't met
License
MIT