Standard Normal Probabilities

Probability and Statistics

To return the value of the standard normal distribution, \( f(z) = \frac{1}{ \sqrt{2 \pi}} e^{\frac{-z^2}{2}}, \) for any value z, you can use the dnorm function in R.

z <- seq(-4, 4, .1)
plot(z, dnorm(z))

plot of chunk unnamed-chunk-1

Areas on the curve

More often, you are interested in the area under the curve between two values of z. Calculus students might be eager to integrate the function but \( f(z) = \frac{1}{ \sqrt{2 \pi}} e^{\frac{-z^2}{2}} \) is not integrable so we're lefting using standard normal tables or, better yet, using a computer to estimate these areas. pnorm returns the area under the curve to the left of any z.

z <- c(-2, -1, 0, 0.5, 3)
pnorm(z); round(pnorm(z),3)
[1] 0.02275013 0.15865525 0.50000000 0.69146246 0.99865010
[1] 0.023 0.159 0.500 0.691 0.999

Probability of a z between two values

If we want the probability that a value will fall between two different z's, we can simply use the pnorm function and subtract. How often is a value higher than the mean but no more than 2.5 standard deviation above the mean?

pnorm(2.5) - pnorm(0)
[1] 0.4937903

Percentiles

Finally, let's say that I want to get the z-score for a 70th percentile value. The qnorm function can help:

qnorm(0.7)
[1] 0.5244005

How many standard deviations below the mean is a 1st percentile value?

qnorm(0.01)
[1] -2.326348