This question already has an answer here:

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?


marked as duplicate by whuber Sep 9 at 18:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


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.

  • $\begingroup$ Stephan thank you. But is there a python code for this equation? I'm not that great with mathematical formulas :) $\endgroup$ – Don Coder Sep 9 at 17:40
  • $\begingroup$ I don't speak Python, sorry. You might want to look through the "Python" and "normal-distribution" tags at SO. Most of which will likely point you at scipy. You might want to post a question there and explain why you don't want to use scipy. $\endgroup$ – S. Kolassa - Reinstate Monica Sep 9 at 18:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.