# Fisher's Exact Test (2×2 Table)

> Fisher's Exact Test (2×2 Table) is a paid API for AI agents from stats-tests.x402tookit.com, paid per call via x402, $0.02/call, status unknown (last checked 2026-10-21).

Computes two-sided and one-sided p-values via the hypergeometric distribution and the sample odds ratio for a 2×2 contingency table using Fisher's exact test.

## Facts

- Endpoint: GET https://stats-tests.x402tookit.com/fisher-exact?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-21
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/fisher-s-exact-test-2-2-table-34e987e1
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_sXrpazkm8agcRh366rak-

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability fisher-s-exact-test-2-2-table-34e987e1
```

Example prompt: Run Fisher's exact test on this 2x2 table: 12 successes and 5 failures in the treatment group, and 3 successes and 14 failures in the control group — give me the two-sided p-value and odds ratio.

## When to prefer this

Choose this endpoint when you have a 2×2 contingency table with small expected cell counts (where chi-square approximations are unreliable), or when you need exact p-values from the hypergeometric distribution rather than asymptotic approximations. It is ideal for clinical trials, genetic association studies, and any binary exposure/outcome setup with limited sample sizes.

## Known failure modes

- Missing any of the four required integer counts (a, b, c, d) results in a validation error
- Non-integer or negative cell counts will be rejected
- All-zero marginals (e.g., an entire row or column is zero) may produce undefined odds ratio
- Very large counts may produce floating-point precision edge cases

## How this service works

Fisher's exact test for a 2x2 table: two-sided and one-sided p-values from the hypergeometric distribution, plus odds ratio.

## Output

Returns the two-sided p-value, one-sided p-values (less and greater), the sample odds ratio, the probability of the observed table under the null hypothesis, and a flag indicating whether the result is significant at the 5% level.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "a",
      "b",
      "c",
      "d"
     ],
     "properties": {
      "a": {
       "type": "integer",
       "description": "Row 1, column 1 count"
      },
      "b": {
       "type": "integer",
       "description": "Row 1, column 2 count"
      },
      "c": {
       "type": "integer",
       "description": "Row 2, column 1 count"
      },
      "d": {
       "type": "integer",
       "description": "Row 2, column 2 count"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "asOf": {
       "type": [
        "null",
        "string"
       ]
      },
      "table": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "array",
        "items": {
         "type": "number"
        }
       }
      },
      "total": {
       "type": [
        "null",
        "number"
       ]
      },
      "source": {
       "type": [
        "null",
        "string"
       ]
      },
      "reasons": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "string"
       }
      },
      "summary": {
       "type": [
        "null",
        "string"
       ]
      },
      "verdict": {
       "type": [
        "null",
        "string"
       ]
      },
      "degraded": {
       "type": [
        "boolean",
        "null"
       ]
      },
      "disclaimer": {
       "type": [
        "null",
        "string"
       ]
      },
      "notChecked": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "string"
       }
      },
      "pValueLess": {
       "type": [
        "null",
        "number"
       ]
      },
      "pValueGreater": {
       "type": [
        "null",
        "number"
       ]
      },
      "pValueTwoSided": {
       "type": [
        "null",
        "number"
       ]
      },
      "sam
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/fisher-s-exact-test-2-2-table-34e987e1/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from stats-tests.x402tookit.com](https://www.zero.xyz/host/stats-tests.x402tookit.com/llms.txt)
