p-value for Chi-square test
If the test statistic $\chi^2$ has chi-square distribution with $n$ degrees of freedom and the observed value of the test statistic is $\chi^2_{obs}$, then the $p$-value of the test for testing
a. left-tailed alternative is $p$-value = $P(\chi^2_{n}\leq \chi^2_{obs})$
.
b. right-tailed alternative is $p$-value = $P(\chi^2_{n}\geq \chi^2_{obs})$
.
c. two-tailed alternative is $p$-value = $2P(Z\geq \chi^2_{obs})$
.
Formula
The $p$-value of chi-square test for left tailed alternative is
$p$-value = $P(\chi^2_{n}\leq \chi^2_{obs})$
The $p$-value of chi-square test for right tailed alternative is
$p$-value = $P(\chi^2_{n}\geq \chi^2_{obs})$
The $p$-value of chi-square test for two tailed alternative is
$p$-value = $2P(Z\geq \chi^2_{obs})$
where,
$\chi^2_{obs}$
is the value of test statistic