How z-scores relate to p-values
A z-score measures how many standard deviations an observation is from the mean of a standard normal distribution. The p-value is the probability of observing a z-score at least as extreme under the null hypothesis.
For a two-tailed test: p = 2 × (1 − Φ(|z|)), where Φ is the standard normal CDF. For a one-tailed test: p = 1 − Φ(z) for an upper tail, or p = Φ(z) for a lower tail.
p (two-tailed) = 2 × [1 − Φ(|z|)]
Two-tailed p-value from the standard normal CDF.
p (one-tailed) = 1 − Φ(z)
Upper-tailed p-value.