Tells you how much of this special curve is below a number you pick.
pchisq(q, df, lower.tail = TRUE)
Key idea
pchisq turns a chi-square test result (the statistic) into a probability using its lopsided curve.
The p-value (chance of a result this big by luck) is usually the upper tail, found as 1 minus the value pchisq gives. (e.g. p = 1 - 0.95 = 0.05)
The result depends on the degrees of freedom (df), a number that sets the curve's shape. (e.g. df = 3)
A larger statistic for a given df gives a smaller p-value (a more surprising result). (e.g. stat = 16, df = 3, p = 0.001)
It connects a test statistic to the common 0.05 cut-off for calling a result surprising. (e.g. df = 1: stat 3.84 -> p 0.05)
Definition
F(q)=Γ(k/2)1γ(2k,2q)
q
the chi-square value
k
degrees of freedom (df)
Γ
the gamma function
γ
the lower incomplete gamma
F(7.815)=P(χ32≤7.815)=0.95
Where you'd use it
A goodness-of-fit test gives a chi-square statistic of 7.8 with 3 degrees of freedom. The p-value is the right-tail area, pchisq(7.8, 3, lower.tail = FALSE) ≈ 0.05, just on the edge of being surprising.
You test whether a die is fair and get a small statistic of 2.0 with 5 df. The upper-tail p-value pchisq(2.0, 5, lower.tail = FALSE) ≈ 0.85, so the die looks fair — a result that ordinary is no surprise.
To find the critical value cutting off the top 5%, you check that pchisq(7.815, 3) ≈ 0.95, confirming 7.815 leaves exactly 5% in the right tail for 3 df.
Frequently asked questions
Which tail do chi-square tests use?
Almost always the upper tail — set lower.tail = FALSE.
What is df?
Degrees of freedom — it sets the shape of the distribution.