I couldn't find any videos or documentation that shows how to calculate p-value of a z-score without using z-table. Isn't it possible or is it that hard?
I know i can use scipy to get that information but how can we calculate without needing them?
Certainly it's possible. After all, people need to calculate the tables in the first place.
Recall the definition of a $p$ value. Given a value $z$, the $p$ value is defined as the tail probability of the standard normal distribution beyond $z$:
$$ p \equiv \frac{1}{\sqrt{2\pi}}\int_z^\infty e^{-x^2}\,dx. $$
This is an improper integral that needs to be numerically evaluated. Or, more precisely, approximated.
scipy.stats.norm.sf(z)*2
; one-sided test: scipy.stats.norm.sf(z)
(Stephan's answer)
$\endgroup$
Commented
Jan 19, 2022 at 8:03