{
  "id": "p-value",
  "version": "85c0c0caf283",
  "status": "published",
  "name": "P-Value Calculator",
  "question": "What is my p-value?",
  "summary": "Computes the p-value of a z, t, chi-square, or F test statistic for a left-, right-, or two-tailed test.",
  "category": "statistics",
  "subcategory": "tests",
  "url": "https://www.acalculator.org/statistics/p-value-calculator",
  "markdown": "https://www.acalculator.org/statistics/p-value-calculator.md",
  "kind": "function",
  "method": "Left-tailed: P(X ≤ s); right-tailed: P(X ≥ s); two-tailed: 2 × the smaller of the two, at most 1, for the chosen distribution under the null hypothesis.",
  "assumptions": [
    "For chi-square and F, which are not symmetric, the two-tailed p-value doubles the smaller tail.",
    "Degrees of freedom may be fractional (for example Welch’s t-test), from 1 up to 100,000.",
    "Chi-square and F statistics cannot be negative.",
    "P-values are good to at least 9 significant digits (about 13 for most inputs; about 10 with degrees of freedom in the tens of thousands)."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "distribution": {
        "title": "Distribution",
        "description": "The distribution of the test statistic: z (standard normal), Student’s t, chi-square, or F.",
        "type": "string",
        "enum": [
          "z-score",
          "t-score",
          "chi-square-score",
          "f-score"
        ]
      },
      "testType": {
        "title": "Test type",
        "description": "Which tail counts as extreme: both, the left, or the right.",
        "type": "string",
        "enum": [
          "two-tailed",
          "left-tailed",
          "right-tailed"
        ]
      },
      "testStatistic": {
        "title": "Test statistic",
        "description": "The value of the z, t, chi-square, or F statistic from your data.",
        "type": "number",
        "minimum": -1000000,
        "maximum": 1000000
      },
      "degreesOfFreedom": {
        "title": "Degrees of freedom",
        "description": "Degrees of freedom of the t or chi-square distribution, or the numerator degrees of freedom of F.",
        "type": "number",
        "minimum": 1,
        "maximum": 100000
      },
      "degreesOfFreedom2": {
        "title": "Denominator degrees of freedom",
        "description": "The second (denominator) degrees of freedom of the F distribution.",
        "type": "number",
        "minimum": 1,
        "maximum": 100000
      }
    }
  },
  "outputs": {
    "pValue": {
      "label": "P-value",
      "description": "The probability, if the null hypothesis is true, of a test statistic at least as extreme as yours.",
      "format": "number"
    },
    "left": {
      "label": "Left tail, P(X ≤ statistic)",
      "description": "The probability of a statistic at or below yours.",
      "format": "number"
    },
    "right": {
      "label": "Right tail, P(X ≥ statistic)",
      "description": "The probability of a statistic at or above yours.",
      "format": "number"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "distribution": "z-score",
      "testType": "two-tailed",
      "testStatistic": 1.96,
      "degreesOfFreedom": 10,
      "degreesOfFreedom2": 10
    },
    "outputs": {
      "pValue": 0.049995790296440856,
      "left": 0.9750021048517796,
      "right": 0.024997895148220428
    },
    "text": "The p-value is 0.049996 for a Z statistic of 1.96 (Two-tailed)."
  },
  "examples": [
    {
      "given": {
        "distribution": "z-score",
        "testType": "two-tailed",
        "testStatistic": 1.96
      },
      "expect": {
        "pValue": 0.04999579029644086
      },
      "source": "standard normal table (z = 1.96 gives 0.05, two-tailed); Python math.erfc(1.96 / math.sqrt(2))"
    },
    {
      "given": {
        "distribution": "z-score",
        "testType": "left-tailed",
        "testStatistic": -2.33
      },
      "expect": {
        "pValue": 0.009903075559164252
      },
      "source": "NIST/SEMATECH e-Handbook 1.3.6.7.1; Python statistics.NormalDist().cdf(-2.33)"
    },
    {
      "given": {
        "distribution": "t-score",
        "testType": "two-tailed",
        "testStatistic": 2.228,
        "degreesOfFreedom": 10
      },
      "expect": {
        "pValue": 0.05001177181711136
      },
      "source": "NIST/SEMATECH e-Handbook 1.3.6.7.2 (t 0.975, 10 = 2.228); Python closed-form t CDF, Abramowitz and Stegun 26.7.4 (docs/progress/WP-26.md)"
    },
    {
      "given": {
        "distribution": "t-score",
        "testType": "two-tailed",
        "testStatistic": 1,
        "degreesOfFreedom": 1
      },
      "expect": {
        "pValue": 0.5
      },
      "source": "hand calculation in content.mdx: 1 − (2 ÷ π) arctan(1) = 1 − 0.5 = 0.5"
    },
    {
      "given": {
        "distribution": "chi-square-score",
        "testType": "right-tailed",
        "testStatistic": 18.307,
        "degreesOfFreedom": 10
      },
      "expect": {
        "pValue": 0.05000058909139812
      },
      "source": "NIST/SEMATECH e-Handbook 1.3.6.7.4 (18.307 at 0.05, 10 df); Python closed form for even df, e^(−x/2) Σ (x/2)^i ÷ i! (docs/progress/WP-26.md)"
    },
    {
      "given": {
        "distribution": "f-score",
        "testType": "right-tailed",
        "testStatistic": 4,
        "degreesOfFreedom": 2,
        "degreesOfFreedom2": 10
      },
      "expect": {
        "pValue": 0.05292214940134464
      },
      "source": "hand calculation in content.mdx: for d1 = 2, P(F ≥ x) = (1 + 2x ÷ d2)^(−d2/2) = 1.8^(−5)"
    },
    {
      "given": {
        "distribution": "f-score",
        "testType": "right-tailed",
        "testStatistic": 3.326,
        "degreesOfFreedom": 5,
        "degreesOfFreedom2": 10
      },
      "expect": {
        "pValue": 0.04999328474393283
      },
      "source": "NIST/SEMATECH e-Handbook 1.3.6.7.3 (F 0.95; 5, 10 = 3.326); Python F CDF as a finite incomplete-beta sum (docs/progress/WP-26.md)"
    }
  ],
  "sources": [],
  "related": [],
  "changelog": [
    {
      "date": "2026-09-29",
      "note": "The example notes no longer mention the old page (user test 2026-09-29)."
    }
  ]
}
